This article introduces the method of executing PHP program with crontab timing in Linux system. Please refer to the friends who are in need. In Linux, the method of executing PHP with crontab Timing is implemented as follows: 1. Use Crontab-e to edit the contents of the Timed tasks: Xx:xx:xx executing a hello.php file2. php files must be in the header line of the file, plus the interpreter path (similar to bash or Perl) #!/usr/local/bin/phpNote: PHP execution requires Apache support, and the execution of shell scripts requires Linux support, while Linux supports the ability to run a program on a timed basis. Then, execute directly in/etc/crontab, as in the following notation: */5 * * * * root/root/hello.phpThe previous practice, first in the crontab to execute a shell program, and then let the shell program to run PHP program, this is actually quite inefficient, instead directly in the/etc/crontab directly with the PHP path, such as */5 * * * * root PHP hello.php, and it can be executed correctly; |