Help with cron job

indysolo62123

New Member
Messages
10
Reaction score
0
Points
0
I am trying to run a cron job that will execute a php file every 5 minutes. I have the time down ,but for some reason the command part isn't working. I tested the php file by entering it's URL and it works fine. Just can't get the cron job to run it. So how would you usually put a php file in the command field?
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
Code:
/usr/bin/php /home/igor/public_html/my_cron_job.php >>/home/igor/public_html/cron_log.txt 2>&1

1. The 'email notification' on the cron page in cPanel does not work. It has been shut off for quite awhile to prevent overloading the mail server.

2. Replace 'igor' with your cPanel username

3. The cron script can be anywhere. In public_html or subdirectoy means you can test it from the web, but that also means someone could accidentally run it. You can put it in a password protected directory or in /home/igor . cron can read it there, but the web cannot.

4. Same for the log file

5. Log file catches all output, planned ( echo , etc ) or not (system or PHP error messages).
 
Top