View Full Version : Setting up a cron for a PHP script

01-14-2004, 11:32 AM
I have a test script here, to try and get a cron job running

function db_connect($database)

mysql_query("INSERT INTO stuff (id) VALUES ('1')");

The script works fine, I loaded it directly and it updates the database. However I want a cron job to execute the script.....

I have tried these alternatives, to update at whatever minutes are a few minutes ahead of me trying them ;)

30,31,32,33 * * * * /ftp/usr/lib/php /var/www/html/global_functions.htm 2>&1 > /dev/null
30,31,32,33 * * * * /ftp/usr/lib/php /var/www/html/global_functions.htm
30,31,32,33 * * * * /var/www/html/global_functions.htm 2>&1 > /dev/null

However, none of them updated the table. Has anyone else here used a cron successfully? I'd appreciate some pointers.


01-20-2004, 12:44 AM
I use cron to launch a perl script every 4 hours. Have you gotten the OK from the technical support people? That's what I did when I began. Cron isn't enabled out of the box.


01-20-2004, 04:28 PM
Hi, thanks for posting.

Yes it is enabled, I had sent an e-mail to support they were not too helpful, saying that the syntax in my cron was "obviously" wrong :o) .... referring to me having 1,2,3,4,5 in the minute field which AFAIK works. He also mentioned they don't provide assistance with this sort of thing.

I'll ask them again in the meantime. Thanks for taking the time to post, and again, any pointers appreciated.


Got confirmation it was already installed and working...AND got it working also. I was pointing to the errr...wrong php :)

/bin/php is the path I should have pointed to, gracias