I have a server 2008 64 bit machine with php5 via fastcgi installed. I want to run a .php script every day at 3 AM. I set up a task and "Last Run Result" says "%1 is not a valid Win32 application"

The event properties describe more failure:

"Task Scheduler failed to launch action "D:\InetPub\tools\something\build.php" in instance "{88cc01f4-9554-4b8f-9836-34d806337d7f}" of task "\Something". Additional Data: Error Value: 2147942593."

Task Category: Action failed to start

Is it possible to run scripts using the task scheduler? If not, how should I go about automating the execution of a php script?

Thanks

link|improve this question
feedback

2 Answers

I mostly run php on *nix machines so not sure about this.

Normally php scripts are run by the web-server when someone requests a page with some php in it.

In your Server 2008 set-up your default action for .php may be set to another action (e.g. 'open file in editor') rather than 'run script using php.exe'

You have to call up the php interpreter and use your actual script as a command line parameter.

Something like

php.exe d:\InetPub\tools\something\build.php

You may also be able to achieve the same effect by associating .php files with the correct program

link|improve this answer
feedback

that makes perfect sense. i changed my task action to php.exe. in the windows 2008 task properties there is a box for an optional argument. i put the path to the php script there, and now it's working like a champ.

this task builds an xml file for a third party to crawl. i think 175 lines of php is much easier to maintain than a vb project.

thanks for your help!

link|improve this answer
This should be a comment and you should accept Loopo's answer as it is correct. – ManiacZX May 10 '10 at 20:39
feedback

Your Answer

 
or
required, but never shown