sudo nano /etc/init.d/apache or sudo nano /etc/init.d/apache2 Search for the start / restart section and add your cli call for your PHP script restart) [..] php -q /tmp/myscript.php & ;;