Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

scheduled task to run php file in windows xp

Posted on 2010-11-28
4
Medium Priority
?
1,271 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 85

Accepted Solution

by:
oBdA earned 2000 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 85

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

These days socially coordinated efforts have turned into a critical requirement for enterprises.
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Suggested Courses

636 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