Connecting Tech Pros Worldwide Forums | Help | Site Map

scheduling a PHP program for after hours run.

Dross
Guest
 
Posts: n/a
#1: Aug 19 '05
WinXP Pro, PHP4, Webserver=xitami, Mysql

I have written a php program which I would like to schedule for a daily
run.

The program queries a database for about to be due quality system tasks
(this is a manufacturing org and we have scheduled events, a big list
actually) and emails the about to be due requirements.

But it appears the php program must run from within a browser.

What I would like to do is, schedule the php program via Win scheduler

Is this doable, or am I using the wrong program (php). I am old and
have no memory.

I want this automatic, I don't want to have to log on and run this
program.

thanks
BobC


Erwin Moller
Guest
 
Posts: n/a
#2: Aug 19 '05

re: scheduling a PHP program for after hours run.


Dross wrote:
[color=blue]
> WinXP Pro, PHP4, Webserver=xitami, Mysql
>
> I have written a php program which I would like to schedule for a daily
> run.
>
> The program queries a database for about to be due quality system tasks
> (this is a manufacturing org and we have scheduled events, a big list
> actually) and emails the about to be due requirements.
>
> But it appears the php program must run from within a browser.
>
> What I would like to do is, schedule the php program via Win scheduler
>
> Is this doable, or am I using the wrong program (php). I am old and
> have no memory.
>
> I want this automatic, I don't want to have to log on and run this
> program.
>
> thanks
> BobC[/color]

Hi Bob,

PHP just loves to be within a webcontext, but you can run it from
commandline too.

Try to find the cgi version of PHP.
(named php-cgi.exe I think)
Maybe you have it already in your PHP.dir
Otherwise download it.

Open a commandprompt, go to the PHP directory where the CGI resides.

try something like
php-cgi -v

if it answers with versionnumber: good.

Now try to invoke the script you want to shedule by hand.
Once you have it running from commandline, try to shedule it.
(Pay attention to userrights and such if sheduler runs it. But I must admit
I know not much of the sheduler, so maybe I talk bull.)

Good luck

Regards,
Erwin Moller

Dross
Guest
 
Posts: n/a
#3: Aug 19 '05

re: scheduling a PHP program for after hours run.


Duh!
I knew that, thanks for sparking my memory.

Got it, works great.
bobc

Alvaro G Vicario
Guest
 
Posts: n/a
#4: Aug 24 '05

re: scheduling a PHP program for after hours run.


*** Dross wrote/escribió (19 Aug 2005 06:11:25 -0700):[color=blue]
> But it appears the php program must run from within a browser.[/color]

Unless your scripts relies on client-side JavaScript, you can easily
rewrite it to work as shell script and send output to a file. Then, it's
trivial to program its execution: since Windows scheduller is a service,
you don't have to log in.

PHP has a command-line version, but regular version works fine too in
command line.


--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
Closed Thread