Can server 2008’s task scheduler run a php file

schedulertaskwindows-server-2008

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

Best Answer

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