PHP Script via Cron

PHP Script via Cron

Posted by: Crys
Posted on: 2003-03-21 11:38:00

I have a php script designed to be run via command line / cron. It runs just fine via the command line. But if I run it via cron I get '/bin/sh: php: command not found
' mailed to me... Do I simply need to find and include the path to PHP in the crontab, or is it more complicated than that?

Re: PHP Script via Cron

Posted by: nate
Posted on: 2003-03-21 12:50:00

In reply to:

Do I simply need to find and include the path to PHP in the crontab, or is it more complicated than that?


Just make sure the shebang (#!) line has the full path to PHP (since cron has a very minimal ENV).

# which php
/usr/local/bin/php


nate.

Re: PHP Script via Cron

Posted by: will
Posted on: 2003-03-21 12:54:00

> Just make sure the shebang (#!) line has the full path to PHP

or put the full path in the crontab; like:
* * * * * /usr/local/bin/php /path/to/script

Re: PHP Script via Cron

Posted by: Crys
Posted on: 2003-03-22 07:56:00

Thank you :) it worked :D course I forgot to add the -q but that's easy to fix

Tags: php scriptcroncrontabpathcommand line