Home >Backend Development >PHP Tutorial >crontab format How to use Linux Crontab to execute PHP scripts regularly
The two methods of Crontab are introduced below.
1. Use PHP to execute scripts in Crontab
Just like calling ordinary shell scripts in Crontab (specific Crontab usage), use the PHP program to call PHP scripts.
Execute myscript.php every hour as follows:
Copy the code The code is as follows:
# crontab -e
00 * * * * /usr/local/bin/php /home/john/myscript.php
Copy the code The code is as follows:
00 * * * * lynx -dump http://www.jb51.net/myscript.php
Copy the code The code is as follows:
*/5 * * * * /usr/bin/curl -o temp.txt http://www.jb51.net/myscript.php
Copy the code The code is as follows:
*/10 * * * * /usr/bin/wget -q -O temp.txt http://www.jb51.net/myscript.php
The above introduces the crontab format and how to use Linux Crontab to regularly execute PHP scripts, including the crontab format. I hope it will be helpful to friends who are interested in PHP tutorials.