Re: setting up a cron job for a PHP script
| From: | CPT John W. Holmes | Date: | Tue, 03 Jun 2003 18:22:34 +0000 |
| Subject: | Re: setting up a cron job for a PHP script | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-150042@lists.php.net to get a copy of this message | ||
You can also call the file through lynx or wget if you can't call the php
executable directly.
lynx --dump http://www.yourserver.com/file.php
wget http://www.yourserver.com/file.php
Down side is that the file has to be in your web root. Works great for
calling remote files, though.
---John Holmes...
----- Original Message -----
From: "Jay Blanchard" <jay.blanchard@niicommunications.com>
To: "Tim Thorburn" <immortal@nwconx.net>; <php-general@lists.php.net>
Sent: Tuesday, June 03, 2003 2:12 PM
Subject: RE: [PHP] setting up a cron job for a PHP script
[snip]
I've setup a simple PHP script that runs through a database table and
sends an email to a group of members asking them to verify their
information. My new ISP allows me to access the cron tab so we can have
this script run at
set intervals. However I'm a little new to the whole cron tab command
line ... is it possible to have a PHP script execute on command from a
cron tab? And if so, could someone proide an example of say having the
script run on the first of every month? We're using 4.3.0 if that
helps.
[/snip]
Find out where the PHP executable is...
which php
...should return something like /usr/local/bin/php
Put the following line in your crontab
15 2 1 * * /usr/local/bin/php -q /path/to/your/script.php
This will run in the 15th minute of the 2nd hour of the 1st of the
month. The -q get PHP to run quietly.
HTH!
Jay
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php