Re: Running a PHP script automatically?
| From: | Keith Vance | Date: | Sun, 22 Sep 2002 05:38:04 +0000 |
| Subject: | Re: Running a PHP script automatically? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-117151@lists.php.net to get a copy of this message | ||
On the Linux box compile PHP as CGI (i.e. don't configure it as an apache
mod). Then you can just run your script from the the command-line.
For example:
#!/usr/local/bin/php -q
<?php
print "Hello world.\n";
?>
The -q suppresses the html crap that gets spit out. I don't know jack
about Redhat (Debian rocks), you might be able to get an RPM that will
install the php executable for you.
To do the crontab:
RUN THIS COMMAND
crontab -e
TYPE THIS
15,30,45,0 * * * * name_of_your_script
THEN
ESC
:wq
Keith Vance
Vance Consulting LLC
www.vanceconsulting.net
(206) 355-2399
Try my open source PHP authentication system, Rampart by visiting http://rampart.sourceforge.net/. Commercial support is
available at, http://www.vanceconsulting.net/support/.
On Sat, 21 Sep 2002, Joseph Szobody wrote:
> Folks, I have a PHP script that needs to be executed automatically every 15 minutes. I have the
> option of doing this on a RedHat linux box, or on Windows 2000 Server.
>
> How would I do this (on either platform) and which would be easier?
>
> I believe somehow I could create a cron job on linux, but I'm a bit confused how that
> would work. Would I just call the php script using Lynx? If so, does the Lynx process die when the
> php script is finished? Will I have dozens of Lynx processes still running at the end of the day?
>
> In Windows, I believe I could use the task scheduler, or something like that. But again, how
> exactly would I call the script? I certainly don't want a new browser window to open every 15
> minutes, especially if it doesn't close again.
>
> Any insight? Thanks!
>
> Joseph
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>