Re: RE: PHP script: need a scheduled task!!!
| From: | Morty McFly | Date: | Sat, 08 Jul 2000 09:09:27 +0000 |
| Subject: | Re: RE: PHP script: need a scheduled task!!! | ||
| References: | 1 | Groups: | php.general php.windows |
| Request: | Send a blank email to php-general+get-5517@lists.php.net to get a copy of this message | ||
Zack,
It's definitely possible to do what you're saying.
You'll need to compile php as a CGI-module, and then maybe start off a
cron job to execute your script at a particular time.
How do you compile a CGI-module? Easy, just configure and compile php with
the defaults. You'll get a binary called 'php' stick that in your 'bin'
folder and you're ready to rock. I've done this and it works great, I
now write php scripts for things that I would normally have used UNIX
shell scripts. You mentioned that you need to access a database, in that
case you'll need to supply the appropriate '--with-' parameter during
configuration (check the manual). But everything else is the same.
How do you run your scripts?
1. Use your favourite text editor to create your script, save it.
e.g. myScript.php
2. Execute it by typing 'php -q myScript.php'
(The '-q' is for quiet mode, without it, you'll get some useless header
stuff.
Enjoy,
Morty
On Sat, 8 Jul 2000, Mark Nold wrote:
>
> Really your only hope is to get a web browser session. On windows you could
> try "Get Right" or one of those other scheduled download managers. Then
> since your script probably outputs some nice success/faiure infor you now
> how a log ofthe last update.
>
> Funnily enough i'd use a Perl to hit the page and log the info then use
> Cron in un*x, AT in NT or the windows scheduler thingy in Win9x. Nice cross
> platform.
>
> If you want a sample of such a script give me yell, or look at libwww it
> has heap of examples on grabbing pages including secured sites.
>
> Also since you are on Win32 look at perl2exe (search the web im not sure
> where i got it) as it's compile your perl script into an executable.
>
> mn
>
>
>
>
> Mark Nold
> markn@alverstone.com.au
> Systems Consultant
>
> Change is inevitable, except from vending machines.
>
>
>
>
> On Saturday, 8 July 2000 12:42, Zack Beatty [SMTP:ZackB@mamamedia.com]
> wrote:
> > Is there a way to schedule a php script to run at a certain time, such as
> > with the Windows Task Scheduler. I need to query a database once a day
> at
> > midnight. In Perl, I would simply use the Windows Task Scheduler to
> execute
> > the Perl script in the shell. However, with PHP, my script is web-based,
> > and can only be executed via a web-browser. A task CAN be scheduled to
> open
> > an Internet Explorer window at any given time. However, it CAN'T be
> > configured to go to a specific web page. Any suggestions? I've heard
> that
> > PHP can be compiled to run from the command prompt (which would
> > theoretically solve my problem), but I'm not ready to pursue that route.
> > Thanks.
> > -zb
> >
>
> --
> 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
>
>