473,516 Members | 2,889 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Scheduling PHP on Win XP

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).

Dec 16 '05 #1
6 2878
NC
Csaba Gabor wrote:

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.


Most likely, this is because you are trying to run the CGI executable.
Try specifying the full path to the command-line interpreter:

AT 7:11 "C:\php\cli\php.exe c:\phpapps\himom.php"

Cheers,
NC

Dec 16 '05 #2
Csaba Gabor wrote:
Note that the VBScript MsgBox requires the /INTERACTIVE flag, but the
PHP popup does not.


What gave you that notion? /interactive for the at command is required
if the scheduled task wants to interact (hence the name) with the desktop.

BTW: at is old hat. See Help & Support and search for schtasks.
Dec 16 '05 #3
NC wrote:
Csaba Gabor wrote:

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.


Most likely, this is because you are trying to run the CGI executable.
Try specifying the full path to the command-line interpreter:

AT 7:11 "C:\php\cli\php.exe c:\phpapps\himom.php"


Thanks for your response. However, I had tried specifying the complete
executable path, and also the complete path to php-win and php-cgi.
All silently fail for me. Does this same test work on your system (and
if you make the test, please specify your system)?

Csaba

Dec 16 '05 #4

Andrew DeFaria wrote:
Csaba Gabor wrote:
Note that the VBScript MsgBox requires the /INTERACTIVE flag, but the
PHP popup does not.
What gave you that notion?


Testing.
/interactive for the at command is required if the scheduled
task wants to interact (hence the name) with the desktop.
Yes, I have read this also in the AT help. Nevertheless, on my
system, things happened as I reported in my original post. Do
the tests turn out differently on yours?
BTW: at is old hat. See Help & Support and search for schtasks.


Thank you for this. I have tested with schtasks using the following
line, and the php script executed fine:
C:\somedir>schtasks /create /SC once /TN test /TR
"c:\winapps\php.net\php
..exe c:\phpapps\himom.php" /ST 10:58:05 /RU system

An aside about schtasks: it seems to require that you specify HH:MM:SS,
but it sets the SS part to 00. Thus, if the minute has just turned and
you want to schedule something 15 seconds from now, it will schedule as
never since the SS=00 will ensure that time has passed. So I have to
wonder why they force inclusion of seconds in the first place.

Csaba

PS. I would like to share a suggestion from Mark (thanks) that is in
the vein of my original himom.vbs example:
AT 11:36 explorer.exe http://localhost/himom.php

This 'worked' but there seems to be a huge overhead. Whereas the
performance using the himom.vbs funnel method was spiffy, with this
method, it took several seconds for the popup to appear, and even after
I had dismissed it, system usage stayed at around 50% for about a
minute.

Dec 16 '05 #5
PS. I would like to share a suggestion from Mark (thanks) that is in
the vein of my original himom.vbs example:
AT 11:36 explorer.exe http://localhost/himom.php

This 'worked' but there seems to be a huge overhead. Whereas the
performance using the himom.vbs funnel method was spiffy, with this
method, it took several seconds for the popup to appear, and even after
I had dismissed it, system usage stayed at around 50% for about a
minute.


Did you use explorer.exe or iexplore.exe? There may be a slight performance
difference between the two.

I should have posted to the group, my error. Here is the post:
You could use AT to schedule Internet Explorer to load the desired PHP page.
Like AT 7:23 iexplore.exe "path to your php page"

-Mark
Dec 17 '05 #6
Csaba Gabor wrote:
Andrew DeFaria wrote:
Csaba Gabor wrote:
Note that the VBScript MsgBox requires the /INTERACTIVE flag, but
the PHP popup does not.


What gave you that notion?


Testing.
/interactive for the at command is required if the scheduled task
wants to interact (hence the name) with the desktop.


Yes, I have read this also in the AT help. Nevertheless, on my system,
things happened as I reported in my original post. Do the tests turn
out differently on yours?


Why would I bother? I simply use Cygiwn and cron. YMMV.
Dec 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2282
by: m3ckon | last post by:
Hi, I want to schedule a backup of three databases on a daily basis. I've written the code to run the 3 backups in TSQL and was wondering how best to automate this procedure? Should I put the code in an sproc and then schedule running that command in the DTS or should I just add the TSQL into a DTS command?? Or is there a better way of...
6
2316
by: Tony Proctor | last post by:
Hi everyone We're experiencing some serious anomalies with the scheduling of ASP threads. I'd be interested to hear if anyone knows what algorithm is used (e.g. simple round-robin, or something more sophisticated), and what situations might perturb it. Even a hint as to what would be considered normal scheduling might help. The root of...
13
6040
by: Mike | last post by:
Normally scheduling a job is a very elementary operation but for some hidden reason I've been unable to schedule a job which runs on a 28 day cycle, even though I have at least 16 other jobs seperately scheduled to run on a 28 day cycle with different start dates/times. My production SQL server is running SQL Server Enterprise Edition...
3
2882
by: Muscha | last post by:
Hi, In our application we need to have a high performance scheduling framework. We want to be able to say for item 21 do an update on such and such time. We will have around 1 million items of this kind with different scheduling time, so not all will be updated per hour. Some will be per hour some will be once every 2 weeks. Does anyone...
3
1406
by: mirek | last post by:
Hello, My ASP.NET application must have additional functionality which isn't typical for ordinary web use. It is: - connecting to the other server using specified protocol (an option to establish dialup connection also) - scheduling some task to be done at the time (e.g. retrieve info from other servers) I've got already this "network...
3
578
by: Alphonse Giambrone | last post by:
Can anyone point me toward a good example of an asp.net scheduling app? Preferrably in vb.net. TIA -- Alphonse Giambrone Email: a-giam at customdatasolutions dot us
1
1788
by: Majed | last post by:
hi I'm planing to make scheduling app and need your advice on the best way to do that,and how to save the tasks to be executed and retrive their data at the right time. your input will be highly appreciated Majed
0
1299
by: Lemune | last post by:
Hello. I need some help on building my sms services application (using modem). My application is to do some scheduling task based on daily, weekly and monthly. On the daily the choice are everyday, weekdays, or every what ever value of the days. On the daily the choice are every what ever value of the week on the selected days. On the monthly...
4
2821
by: Dinsdale | last post by:
I'm looking at adding scheduling features to an application and I wanted to ask the community about any experience with scheduling components, either open source like from code project or from a vendor. I'd like to be able to create schedules and lock resources for things like collision detection (two events trying to use the same...
2
26803
Ritchie
by: Ritchie | last post by:
Please can anyone help me with d programs in C for CPU scheduling: WAP to show FCFS scheduling algorithm. WAP to show SJF scheduling algorithm. WAP to show Priority scheduling algorithm. WAP to show Round-Robin scheduling algorithm. disk scheduling:
0
7276
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7182
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7581
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7548
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5714
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3267
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
1624
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
825
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
488
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.