Solved

scheduled task to run php file in windows xp

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
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.

740 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