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
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
You may also be able to achieve the same effect by associating .php files with the correct program
It is definitely possible to schedule php scripts to run as scheduled tasks and it is possible to pass arguments to the php script similar but not the same as you pass them to a PHP script via a browser. You will not access passed parameters via $_REQUEST. You will use $_SERVER['argv'] instead and parse yourself.
There are differences in the runtime environments so if your script is designed to be run both from a browser and also from the command line, you can use