Solved

scheduled task to run php file in windows xp

Posted on 2010-11-28
4
1,216 Views
Last Modified: 2012-05-10
i created a bat file with command C:\WINDOWS\system32\cmd.exe & cd C:\xampp\php & php Filename.php & exit

created scheduled task to run that .bat file, but the php file is not execting. when i manually run the bat from cmd it works.
0
Comment
Question by:rajccs
  • 2
4 Comments
 
LVL 82

Accepted Solution

by:
oBdA earned 500 total points
Comment Utility
Try to schedule php.exe directly, probably like that:
Run: "P:\ath\to\php.exe" "C:\xampp\php\Filename.php"
Start in: C:\xampp\php
The account you're using to schedule this needs to have the user right "Logon as batch job".
0
 

Author Comment

by:rajccs
Comment Utility
do i need this in the bat file and schedule that bat file?? i created bat using this and clicked it to open, but it gave me error
0
 
LVL 82

Expert Comment

by:oBdA
Comment Utility
There's no need for a batch file for what you're trying to do; just fill the "Run" and "Start in" fields of the scheduled task as described above (adjusting the paths accordingly).
0
 
LVL 29

Expert Comment

by:pwindell
Comment Utility
PHP cannot run outside the environment created by the Web Server because it has no PHP Interpreter (web server) nor the Client-side execution environment to run in (virtual environment created by the web browser) for any Client-side code produced by the Server-side PHP script when it runs.

If you want a script to run straight from a command prompt then it needs to be a script that the Windows Scripting Host can run such as Java Script, JScript, or VBScript.  And the scripting code must be written to run under the Windows Scripting Host,....which is different than it would be written when it runs under a PHP or ASP interpreter provided by a web service.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now