PHP Cron Jobs with cPanel

Running PHP scripts automatically can have some big benefits. You can wait to have things get done when there is less traffic on your server, or you can ensure daily tasks get done on time.

cPanel Simple Cron
Even if you do not know anything about cron jobs, and have never run a cron job before – you can get started with the simple cron tool built into cPanel. The url for it is:

https://www.yoursite.com:2083/frontend/x/cron/simplecron.html?

A few things you’ll need is the path to php and the path to the script that you’ll be running. You will need the full path to do this. If your path to PHP differs then the one below, then change it – otherwise keep it as is. Don’t know the path? This is most likely correct for you, just keep an eye out to see if the script does indeed run.

The command to run:
/usr/local/bin/php -f /home/(username)/public_html/(scriptname).php

Next you’ll want to select an option from all the select boxes. Remember to select an option in each box. If you want something to run every day at 4AM, select Minute: 0; Hour: 4; Day: Every; Month: Every; Weekday: Every;

Click save and you are all set! You’ll get an email every time the cron job runs, but if you don’t want to get it – put :blackhole: into the output email field at the top.

3 thoughts to “PHP Cron Jobs with cPanel”

  1. Hello, nice idea u gave but u didn’t told anything about ‘-f’ what that is intended for as i saw ‘-q’ at somewhere else, please add that information also ,thanks

  2. to find the path to php,
    log on to the server with SSH, then run this command:
    ——————-
    which php
    or
    whereis php
    ———————-
    This will give you the path to the php executable, probably:

    /usr/local/bin/php

Comments are closed.