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

I'm trying to run a PHP script everyday at midnight, so my cron has the following entry

@daily /usr/bin/php /websites/xxz/misc/wU5HaFre.php

/websites/xxz/misc/wU5HaFre.php has 755 rights, so it's executable.

which php provides /usr/bin/php, whereis php provides

php: /usr/bin/php /usr/bin/X11/php /usr/share/php /usr/share/man/man1/php.1.gz

So what's wrong? It just doesn't execute.

share|improve this question
    
What does syslog say when CRON is ran? –  mako_reactor Feb 22 '13 at 18:08
    
@mako_reactor what do you mean? –  Christian Feb 22 '13 at 18:14
1  
When a cron job is ran, the log is written to /var/log/syslog or /var/log/messages. Look in the log for the cron log: it would looks somthing like: 22 12:17:01 hostname CRON[426] Message –  mako_reactor Feb 22 '13 at 18:16
    
Feb 22 19:15:01 rnd-cust2 /USR/SBIN/CRON[24164]: (www-data) CMD (/usr/bin/php /websites/xxz/misc/wU5HaFre.php) seems to pop out pretty often. @mako_reactor –  Christian Feb 22 '13 at 18:27

1 Answer 1

It seems www-data is trying to run the script (is this what you want?) Run:

sudo -u www-data /usr/bin/php /websites/xxz/misc/wU5HaFre.php

in terminal and see what the output is, or if the script works.

share|improve this answer
    
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/2010052 5/suhosin.so' - /usr/lib/php5/20100525/suhosin.so: cannot open shared object fil e: No such file or directory in Unknown on line 0 Could not open input file: /websites/xxz/misc/wU5HaFre.php –  Christian Feb 22 '13 at 18:57
    
I changed php to php5 and things started running, but it produces this error: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/2010052 5/suhosin.so' - /usr/lib/php5/20100525/suhosin.so: cannot open shared object fil e: No such file or directory in Unknown on line 0 –  Christian Feb 22 '13 at 19:35
    
What linux distro are you using? Did you install/compile php5-suhosin? –  mako_reactor Feb 22 '13 at 20:27
    
Like I said in the title, Debian. Squeeze to be accurate. How do I install/compile php5-suhosin as apt-get install php5-suhosin gives Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: php5-suhosin : Depends: phpapi-20090626 E: Unable to correct problems, you have held broken packages.? –  Christian Feb 22 '13 at 20:31
    
And also: apt-get install phpapi-20090626 Reading package lists... Done Building dependency tree Reading state information... Done Package phpapi-20090626 is a virtual package provided by: php5-cli 5.3.3-7+squeeze14 [Not candidate version] php5-cgi 5.3.3-7+squeeze14 [Not candidate version] libapache2-mod-php5filter 5.3.3-7+squeeze14 [Not candidate version] libapache2-mod-php5 5.3.3-7+squeeze14 [Not candidate version] E: Package 'phpapi-20090626' has no installation candidate –  Christian Feb 22 '13 at 20:32

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.