Re: Scheduling tasks
| From: | Richard Lynch | Date: | Sat, 31 Aug 2002 00:17:38 +0000 |
| Subject: | Re: Scheduling tasks | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-114730@lists.php.net to get a copy of this message | ||
>Hi,
>
>I'm trying to work out how to schedule tasks in php. I would like to use at
>but are having a few difficulties.
>
>Does anyone have any suggestions on an alternate way to schedule a command
>to run on the system via php.
Make sure you have configured and installed PHP as a "CGI" as well as
Module.
Read "man 5 crontab"
Do something like:
crontab -e
Type in something like this:
MAILTO=toddp@kjross.com.au
0 7 * * * /usr/bin/php -q /full/path/to/your/php/script.php
Then save that (:wq if you're in vi/vim)
This line will run something every day at 7 am. You'll have to work out the
* crap for yourself from "man 5 crontab" It's pretty clear there.
You might need /usr/local/bin/php instead of /usr/bin/php if that's where
PHP ended up. Or even some other place.
If you didn't compile PHP as CGI as well as Module, you need to go back to
the source and do it:
cd /usr/src/php-4.x.x
cp config.nice config.cgi
Edit config.cgi, and rip out the line about "apache" or "apxs"
Then do:
./config.cgi
make
make install
Pay attention to the output, but especially the part of "make install" that
tells you where it's gonna put php. Probably /usr/local/bin/php
--
Like Music? http://l-i-e.com/artists.htm