Live chat

How to run PHP scripts on a schedule (CRON)

You can run PHP scripts at a specified time with the frequency you want.

Examples of running your scripts:

/usr/bin/wget -O /dev/null -q http://your_domain/file_name.php
or
/usr/bin/lynx -dump http://your_domain/file_name.php > /dev/null
another way
/usr/bin/curl –silent http://www.your_domain/file_name.php > /dev/null

If the script uses require or include functions with relative paths specified, use a call to the chdir() function at the start of the script to set the current working directory.
Then you can run the script like this:
/usr/bin/php -q $HOME/script.php > /dev/null 2>&1
$HOME — needs to be replaced with /var/www/username/path_to_script/script.php