Hi All,
Today i just want to share that how to create a cron job in Cpanel to run the PHP script.
I hope everyone knows that what is Cron job : it is the task schedule in Linux which will run on predefined time interval. its same concept like schedule tasks in Windows OS.
To create the cron job, open the Cpanel and select “cron jobs”.
You can see that in drop down list there are lots of common schedules of crone job, you can select it, or create your own schedules.
In Command text box, write the PHP program path and file to be executed like:
/usr/local/bin/php -q /home/<username>/script.php
Hi,
very helpful information guide.
/usr/local/bin/php -q /home//script.php
What’s with the “-q” ????
The problem I noted from my own (beginner) experience is that using different variations of the PHP program path, it always showed the “tick” sign indicating it’s correct:
/usr/local/bin/php /home//script.php
/usr/local/bin/php -q /home//www/script.php
/usr/local/bin/php -q /home//public_html/
script.php
/usr/local/bin/php /home//www/script.php
/usr/local/bin/php /home//public_html/
script.php
/usr/local/bin/php/home//script.php
So, which one is the official correct one that would definitely work?
Also, I was told that some PHP actions or functions must be “enabled” such as url_include and url_fopen – for certain php script to work.
Please let me know your answers/guidance to the above.
Thank you in advance