1

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.

  • What does syslog say when CRON is ran? – mako_reactor Feb 22 '13 at 18:08
  • @mako_reactor what do you mean? –  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 –  Feb 22 '13 at 18:27

1 Answers1

0

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.

mako_reactor
  • 398
  • 4
  • 11
  • `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` –  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 ` –  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.`? –  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 ` –  Feb 22 '13 at 20:32
  • You may need to compile php5 from source and add Suhosin in the configuration. Seems your apt repos are not liking php5-suhosin... – mako_reactor Feb 22 '13 at 20:40
  • And how I'm supposed to do that? I've never compiled anything. –  Feb 22 '13 at 20:46
  • www.osmialowski.co.uk/compile-php-5-3-11-on-debian-squeeze – mako_reactor Feb 23 '13 at 14:06