How to setup php cron job in hostgator cpanel web hosting

AVOID THIS SITE – I signed up to have my domain and email addresses changed. I was told that it would take 24-48 hours for the transfer. 35 days later, it’s still not done, but they charged me immediately. When I called to ask why the transfer was never done, they had no answer. Gurinder Kaur, Australia,

This tutorial is for web developers who are interested to put / setup cron jobs in Shared web hosting. I am using Hostgator’s Cpanel web hosting for demonstration. First i have created sample PHP script, in my web hosting.

Then i have to add email address, so that server notifies by sending email to provided address, each time cron job runs.

Finally I added the time scheduling for execution of cron job. In this example i want my job to execute after every 15 minutes. We can schedule to once every hours, once every day, once every week, once every month or so on.

Then in last i have added the path of the script. Before writing the path, i used php command. php is written before the name of script because, this calls php command line and executes the php script.

For reference on Hostgator hosting you can refer to this information

To know the exact path of your web server you can use
phpinfo() or echo $_SERVER[‘SCRIPT_FILENAME’];



Post A Comment