In order to execute a PHP file from the CRON, you need to add a line to your PHP script. It has to be the first line of your script and must contain your server's PHP executable location:
As an example, the above line would go before the start of the PHP code:
Now, in your cPanel area, click on the CRON and then the particular job you want to run. For the commnad line put in the following;
0 23 1 * * php /path/to/your/cron.php
* * * * * command to be executed
- - - - -
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)
Please note, executing a crontab every MINUTE or every couple of minutes is a quick way to get your site suspended. Don't do it! Also, since crons run in the background, it's sometimes difficult to see how long something has been running. If you tie up system resources, it's another method in how your site can be suspended.
CRON Jobs should run no more frequently than every 15 minutes. If you execute a cron job more often than every 15 minutes, your site may be suspended.
If you do not wish to edit the PHP file, or the PHP file is encrypted, you may want to use the following line as the Command for the CRON instead:
php -q /path/to/your/cron.php
If you have questions about your CRON file, please contact support.