Solved

scheduled task to run php file in windows xp

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

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

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

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
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.

726 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