Monday 15 May 2017

Godaddy cron job setup for running php script in linux server




log into your GoDaddy account

click to expand the "Web Hosting" section and find the server in question

click the "Manage" button (it used to be labeled "Launch")

on the "Hosting Details" page in "Tools" section, click "Cron Job Manager" button

on the "Cron Job Manager" page, click "Create Cron Job" button

enter the title you want and select the frequency (1 hour is the most frequent allowed EDIT: GoDaddy has added 15-minute increments to the frequency choices.)

enter the command below (with your info):

wget http://YOUR_DOMAIN/YOUR_PATH/YOUR_PHP_FILE.php > /dev/null 2>&1

in "YOUR_PHP_FILE.php" code all the actions you want to be performed and include a call to mail() (or whichever mail method you may want to use assuming you have configured that properly).

By using mail() the SMTP relay server will already be set properly in the "php.ini" file to: relay-hosting.secureserver.net -- which you can confirm using phpinfo().


1 comment:

  1. Great post.
    WebCron is a great method of automating tasks on your server if you’re not blessed with cron jobs, you can be found a list of free webcron services at: http://www.cronjobservices.com.

    ReplyDelete