RE: [PHP] php as cron
| From: | Darren Gamble | Date: | Mon, 10 Dec 2001 19:12:55 +0000 |
| Subject: | RE: [PHP] php as cron | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-77225@lists.php.net to get a copy of this message | ||
Good day,
Calling another program with this script is unnecessary, since you are using
the "shebang" operator.
Instead of:
*/2 * * * * php /home/crontest.php > /dev/null
Use:
*/2 * * * * /home/crontest.php > /dev/null
Which should work just fine.
As pointed out, the reason you were getting the message was because cron is
not able to find "php" because /usr/local/bin is not in the path. If you
really want to use it, then the following:
*/2 * * * * /usr/local/bin/php /home/crontest.php > /dev/null
would also work. You could remove the #! line in your script if you do so.
============================
Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948
-----Original Message-----
From: jr@JohnRudnick.net [mailto:jr@JohnRudnick.net]
Sent: Monday, December 10, 2001 12:12 PM
To: Darren Gamble
Cc: 'me@shanewright.co.uk'; php-general@lists.php.net
Subject: RE: [PHP] php as cron
Why not just use lynx to run it?
*/2 * * * * /usr/local/bin/lynx -dump crontest.php
JR
> 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@email.com","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: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>