Cron not running

Hi,

The current cron does not run.

0 23 * * * root php -d safe_mode=“off” /home/[sitename]/public_html/script.php 1>/tmp/1.txt 2>/tmp/2.txt

How do I know this ? script.php should generate an xml and it fails doing that. If I run the script in a browser www.sitename.com/script.php it runs ok and it generates the file.

Can you tell me what could be set up wrong here ?

You can try setting it up with wget or lynx as:

lynx -dump http://www.sitename.com/script.php >> /tmp/1.txt

or;

lynx -dump http://www.sitename.com/script.php > /dev/null

or;

/usr/bin/wget --quiet “http://www.sitename.com/script.php

Thank you for your replies.

I don’t have access on the server and the admin says the cron set-up looks ok and that I should take a look at the php script. The cron run just fine up until a week or so ago. I don’t know what could have changed. I will take a look at the path again.

2.txt contains 2 notices and I’m almost sure this is not the problem. 1.txt is empty.

Try to run the command from commandline without redirecting the output:
php -d safe_mode=“off” /home/[sitename]/public_html/script.php

Possibly, you’ll see the errors.

Also, try to check the files /tmp/1.txt and /tmp/2.txt

Cron doesn’t have the same path you have when logged in. To overcome this problem I always make sure every path I type for cron is absolute.

In this case I would change php in the command with /usr/bin/php or wherever your php executable is located (if you’re not sure type “whereis php” on the command line).