can't i run php scripts with a crontab?

can't i run php scripts with a crontab?

Posted by: pedrotuga
Posted on: 2006-10-23 09:29:00

I got an error mesage on my email.

"php: comand not found"

what da heck... it works without any problem on the cli.

can somebody help?

http://shareminer.com

Re: can't i run php scripts with a crontab?

Posted by: sdayman
Posted on: 2006-10-23 16:01:00

Use full paths in cronjobs. Like:
12 * * * * /usr/bin/php ~/bin/myscript.php

I'm guessing at the php path, but it also depends on if you want php4 or php5. Do a 'which php' to get the full path, then test your script manually using full paths.

-Scott

Re: can't i run php scripts with a crontab?

Posted by: pangea33
Posted on: 2006-10-23 17:14:00

http://wiki.dreamhost.com/index.php/Cron#Executing_a_PHP_Script_with_Crontabs

In reply to:

To execute a PHP script using crontabs, you must add this line to the top of the PHP script you want to execute for it to work:


#!/usr/local/bin/php -q

http://benconley.net
http://teamshocker.com

Re: can't i run php scripts with a crontab?

Posted by: pedrotuga
Posted on: 2006-10-23 17:16:00

so, i need to define the full path to my php binary... i see... i will try that.

btw, i take the chance to get an answer to another question....
how do i run php5 scripts on the cli? i guess defining the full path should do it... but where is the php5 interpreter?

http://shareminer.com

Re: can't i run php scripts with a crontab?

Posted by: rlparker
Posted on: 2006-10-23 17:30:00

In reply to:

btw, i take the chance to get an answer to another question....


You can *always* ask another question, but is usually better to put it in it's own thread so others can find it easier wink

In reply to:

where is the php5 interpreter?


/dh/cgi-system/php5.cgi (from the Dreamhost wiki).

--rlparker


Tags: php scriptscrontabcliheckemail