How to run PHP scripts on a schedule.


You can run scripts in PHP at the specified time with the desired frequency. To do this, you need to use the PHP-CLI interpreter.


Since not all PHP programs can work through the SAPI CLI without prior modification, you can run them through wget. For example:


/usr/local/bin/wget -O /dev/null -q http://mysite.tld/cron.php?action=123

If the script uses the require, include functions, and relative paths are specified in them, then at the beginning of the script being executed, use the chdir() function call, which will specify the current working directory.