Good day,

Doesn't having the statement #!/usr/local/bin/php -q at the start of the
program makes running php (rather than the script itself) redundant?  Why
not just call the script in the crontab?

============================
Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-----Original Message-----
From: Shane Wright [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 10, 2001 11:47 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] php as cron


Hi

You probably need to set the path to your PHP binary in crontab.

Alternatively (this is probs a better way), wrap the whole lot up in a
simple 
shell script and get cron to run the shell script.

It's easier than it sounds...

#!/bin/bash
cd /path/to/php/scripts
php < myscript.php > /dev/null

(also, I tend not to have PHP direct output to /dev/null, but to configure 
cron not to send emails on completion - that way you get the info when you 
run the script on the command line but dont get overrun with pointless
emails)

Hope that helps :)

--
Shane

On Monday 10 Dec 2001 5:54 pm, Jay Paulson wrote:
> I'm trying to test php running as a cron job and I have installed php as a
> CGI in /usr/local/bin and I have edited my crontab file to call a php file
> every two minutes.  However, it's not working and I was wondering if you
> all would know what's going on.  Anyway, here's how I have things set up.
>
> crontab file:
> */2 * * * * php /home/crontest.php > /dev/null
>
> crontest.php:
> #!/usr/local/bin/php -q
> <?php
> mail("[EMAIL PROTECTED]","cron test", "testing",NULL);
> ?>
>
> email I'm receiving with error:
> Subject: Cron <> php /home/crontest.php > /dev/null
> Body: /bin/sh: php: command not found
>
> thanks for any help.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to