Solved

scheduled task to run php file in windows xp

Posted on 2010-11-28
4
1,235 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 84

Accepted Solution

by:
oBdA earned 500 total points
ID: 34225683
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
ID: 34225733
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 84

Expert Comment

by:oBdA
ID: 34225748
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
ID: 34249426
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have done a reformat of your hard drive and proceeded to do a successful Windows XP installation, you may notice that a choice between two operating systems when you start up the machine. Here is how to get rid of this: Click Start Clic…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

856 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