From: Richard Quadling on
2009/9/23 Vinay Kannan <vinykan(a)gmail.com>:
> Hi,
>
> I am developing a web application in PHP, the db is mysql.
>
> I want to develop something like a batch file, which would run everyday,
> query mysql and throw the output to another table which would then perform
> some additional functions.
>
> Is something like this possible?? i am working on windows thats why said a
> batch,but not rigid about the batch, it cud even be Java.
>
>
> Thanks,
> Vinay
>

Take a look at http://docs.php.net/manual/en/install.windows.commandline.php
for using PHP from the command line on windows. The command lines you
use are the same for the task scheduler.

--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling
From: Vinay Kannan on
Thank You Neil !

So if I write in a command like C:\php\php.exe C:\path\to\script.php in a
batch file, and have another batch file to run it at given time frames, then
the PHP file would make the updates and perform the functionalities that its
required to do, is it? coz what I have on my mind is that the tasks are run
and the functions are performed even if theres no one to run in the command,
that can be done right?

Vinay Kannan.

On Wed, Sep 23, 2009 at 5:40 PM, Niel Archer <not(a)chance.now> wrote:

> > Hi,
> >
> > I am developing a web application in PHP, the db is mysql.
> >
> > I want to develop something like a batch file, which would run everyday,
> > query mysql and throw the output to another table which would then
> perform
> > some additional functions.
> >
> > Is something like this possible?? i am working on windows thats why said
> a
> > batch,but not rigid about the batch, it cud even be Java.
>
> Not only possible but very simple. Just write the php as normal and use
> Windows' Scheduler to run it with something like:
>
> C:\php\php.exe C:\path\to\script.php
>
> I have several scripts like this scheduled to do basic maintenance work
> or carry out automated tasks.
>
> > Thanks,
> > Vinay
>
> --
> Niel Archer
> niel.archer (at) blueyonder.co.uk
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
From: Richard Quadling on
2009/9/23 Vinay Kannan <vinykan(a)gmail.com>:
> Thank You Neil !
>
> So if I write in a command like C:\php\php.exe C:\path\to\script.php in a
> batch file, and have another batch file to run it at given time frames, then
> the PHP file would make the updates and perform the functionalities that its
> required to do, is it? coz what I have on my mind is that the tasks are run
> and the functions are performed even if theres no one to run in the command,
> that can be done right?
>
> Vinay Kannan.
>
> On Wed, Sep 23, 2009 at 5:40 PM, Niel Archer <not(a)chance.now> wrote:
>
>>  > Hi,
>> >
>> > I am developing a web application in PHP, the db is mysql.
>> >
>> > I want to develop something like a batch file, which would run everyday,
>> > query mysql and throw the output to another table which would then
>> perform
>> > some additional functions.
>> >
>> > Is something like this possible?? i am working on windows thats why said
>> a
>> > batch,but not rigid about the batch, it cud even be Java.
>>
>> Not only possible but very simple. Just write the php as normal and use
>> Windows' Scheduler to run it with something like:
>>
>> C:\php\php.exe C:\path\to\script.php
>>
>> I have several scripts like this scheduled to do basic maintenance work
>> or carry out automated tasks.
>>
>> > Thanks,
>> > Vinay
>>
>> --
>> Niel Archer
>> niel.archer (at) blueyonder.co.uk
>>
>>
>>
>> --
>> PHP Database Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>

Save yourself the batch files.

Just use ...

C:\php\php.exe -f C:\path\to\script.php --

as the command.

The -f is for completeness. If you want to pass parameters to your
script, put them after the --

e.g.

C:\php\php.exe -f C:\path\to\script.php -- --scriptparam1 --scriptparam2



The task scheduler is a windows service. It runs even if you are not logged on.


Richard.


--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling