Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a PHP script which downloads and manipulate an image from some server and then saves it locally. Because image is update every 5 minutes I want to download and save that image every 5 minutes also. If I run script from browser or console it runs perfectly, if it's ran from crontab image doesn't create. logPHP.log file is created with errors below.

Crontab:

*/5 * * * * /usr/bin/php5 -f /var/www/radar/radar.php > /var/www/logPHP.log

EDIT:

Errors I get:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/intl.so' - /usr/lib/php5/20090626+lfs/intl.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/pspell.so' - /usr/lib/php5/20090626+lfs/pspell.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/snmp.so' - /usr/lib/php5/20090626+lfs/snmp.so: cannot open shared object file: No such file or directory in Unknown on line 0
share|improve this question
    
Try adding 2>&1 at the end of the line to capture the ERROR messages that are uncaptured in the above. –  mdpc Apr 5 '13 at 21:41
    
Errors in edited question –  Soriyyx Apr 5 '13 at 21:51

2 Answers 2

There are php ini files trying to load non-existent extensions. Under /etc/php5 look for

extension=intl.so
extension=pspell.so
extension=snmp.so

and delete them.

Edit: However, this probably isn't the cause of the problem. Most likely there are environment variables that aren't being set for the cron job.

share|improve this answer

Syslog will just tell you the exit code of the process. So it won't tell you any write errors that shell had because the actually php process ended correctly.

My assumption is that user who's crontab it is running as does not have permission to write to /var/www. Even the php script didn't output any content that file should still be created.

Lastly, the cron deamon will mail the user with any output, that is not captured. So if there was an error, you should get an email. cat /var/spool/mail/$USER

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.