Crontab and PHP help

when i run the my php script from Putty command line it works fin, but when in the crontab file it stops after a few results.

Command line is:-

php path/path/script.php

The script downloads a xml file then steps through each url and scrape the price from the sit and writes it to another xml file.

I have searched the internet and can not find any help.

Sidabm

Check if the file which you are writing to has any permission problems .

What happens is it seems to wrote the header and the first few records then stops on cron, but from putty it manages to finish the file and write the closing argument of the xml and echo file created.

Anyway make sure in the script you always use full path names and explicitly set some env variables if used

Also try capturing the error and chk

like 2>&1 | mail -e -s 'err' xyz@abc.com

You will have to bear with me, I am new to this, but i assume the line will look something like this:-

10 11 * * * php path/path/script.php like 2>&1 | mail -e -s 'err' xyz@abc.com

Sidabm

10 11 * * * php path/path/script.php like 2>&1 | mail -e -s 'err' xyz@abc.com


10 11 * * * /usr/bin/php /path/path/script.php ....

Try to also use the full path of php you can get the path of the php by using

which php

also the script path which you are showing please use the full path

HTH,
PL

I have a problem, now when i log in using putty and type crontab -e ot -l i get permission denied......

My host has fixed the permission problem, now just need to look at the old issue....

---------- Post updated at 09:04 PM ---------- Previous update was at 01:27 PM ----------

Don't know if it was my hosting company resetting my server or following the advice you gave, but it seems to be working now. I think it was the tip you gave me.

Thanks for all your help

Sidabm