Milos911 Milos911 - 4 months ago 55
PHP Question

Godaddy cron job setup for running php script

can you help me setup cron job on godaddy webhosting? I have php file that i need to run, it is located in cron subdirectory (so address is http://test.com/cron/file.php).
What do i need to write in command input field, so this file is runned?

Answer

At the time of this writing, on GoDaddy shared hosting, i could NOT use the following commands: ping, curl, nc, lynx

but i COULD use: wget

I successfully created a cron job using wget to load a PHP file containing a call to mail().

  1. log into your GoDaddy account
  2. click to expand the "Web Hosting" section and find the server in question
  3. click the "Manage" button (it used to be labeled "Launch")
  4. on the "Hosting Details" page in "Tools" section, click "Cron Job Manager" button
  5. on the "Cron Job Manager" page, click "Create Cron Job" button
  6. enter the title you want and select the frequency
  7. 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().

Comments