a cron (php) job delima

I was trying to run a PHP script from CRON and kept getting a “XSLTProcessor class not found message”.

This really puzzled me since I had no problem to run the exactly same script from the command line. I tried different stuff, and one point even re-compiled PHP.

Feeling hopeless I put phpinfo() in the script to see what kind of PHP environment is running in CRON and found out the configure options and build date are not the same with the current version. OK, what’s going on?

It turned out, I have an older copy of PHP executable in /usr/bin, which was probably compiled and left there by my hosting company (by the way this is a VPS server), and my newer re-compiled PHP is under /usr/local/bin.

Guess what, in /etc/crontab file, the path is: “PATH=/sbin:/bin:/usr/sbin:/usr/bin”, and this is why the older PHP which didn’t have xslt compiled in always got picked up.


This entry was posted in server setup. Bookmark the permalink.