On Nov 8, 2007, at 7:33 PM, Walt Haas wrote:

Wade Preston Shearer wrote:
I have a PHP script that runs as intended and without errors when run manually from the command line. When I set cron to run it, however, it fails. It is my understanding that cron executes the script as the user that set up the cron job. Is that true? What would be different from when I run it manually compared to when cron is running it?
Usually some environment variables - the path may not include everything you need to run your script, even though it runs with your permissions. You didn't say exactly what you're running on but the usual thing is to pare down the path to the minimum.


I second the idea of looking at environment variables, often times no path will be set so it won't be able to find the programs you are trying to run. That is a common issue with cron jobs that don't work but run fine manually.

For instance, you should call 'php your_script.php' it should be something like '/usr/local/bin/php /path/to/your_script.php'. Obviously substitute the location of your php binary and script file for the real thing on your system. This would hold true even for basic things like grep and awk, you need to provide the full path the file.

--
Joseph Scott
http://joseph.randomnetworks.com/



_______________________________________________

UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net

Reply via email to