To set up and run a PHP script as a cron job on a Linux or Unix system, you will need to follow these steps:
crontab -eSource:www.lautturi.com
This will open the crontab file in your default text editor.
MINUTE HOUR DOM MONTH DOW COMMAND
MINUTE
: The minute of the hour at which the command will be executed (0-59).HOUR
: The hour of the day at which the command will be executed (0-23).DOM
: The day of the month on which the command will be executed (1-31).MONTH
: The month of the year in which the command will be executed (1-12).DOW
: The day of the week on which the command will be executed (0-6, where 0 is Sunday).For example, to run the script every hour on the hour, you would specify 0 * * * *
.
php -f /path/to/script.php
Replace /path/to/script.php
with the path to your PHP script on the system.