You are here: Scheduling PHP on Win XP « PHP Programming Language « IT news, forums, messages
Scheduling PHP on Win XP

Posted by Csaba Gabor on 12/16/05 04:03

I would like to use the AT command under Win XP to schedule (CLI)
php.exe. I thought it would be as easy as: AT 7:11 "php
c:\phpapps\himom.php". However, this gives me an error. My solution
is inducing the gag reflex in me, so perhaps someone can point out an
improvement.

himom.php (to show a Message Box) looks like so:
<?php
function popup ($text, $title="PHP popup", $timeout=4, $style=131120) {
$oWSH = new COM("WScript.Shell");
if (is_null($text)) $text = "NULL";
$oWSH->Popup($text, $timeout, $title, $style); }
popup("Hi mom"); // proof of access
?>


So I wrote a single line c:\phpapps\himom.vbs like so:
MsgBox("Hi mother")

and scheduled it like so: AT 7:15 /INTERACTIVE "c:\phpapps\himom.vbs"
This worked and I got the expected (Hi mother) Message Box


I now rewrote himom.vbs as follows:
// First 4 lines get the directory that himom.vbs is in
Set oWsh = WScript.CreateObject("WScript.Shell")
baseDir = WScript.ScriptFullName
pos = InStrRev (baseDir, "\")
baseDir = mid(baseDir,1,pos)
// Now dispatch to himom.php in the same directory
Set oShell = CreateObject("WScript.Shell")
oWsh.Run "php " & baseDir & "\" & "himom.php",0,false

and scheduled it like so: AT 7:23 "c:\phpapps\himom.vbs"
This time I got the "Hi mom" Message Box (from PHP). Note that the
VBScript MsgBox requires the /INTERACTIVE flag, but the PHP popup does
not. Regardless, this solution leaves me far from the warm fuzzies.
Can anyone tell me the proper way to invoke a php app using AT?

Thanks,
Csaba Gabor from Vienna

Motivation: I will be getting incoming requests to my server (with php
running as a module under Apache 2). Certain requests will require me
to schedule php.exe (CLI) to run an information retrieval program at a
later point in time (up to 10 days later).

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация