views:

145

answers:

1

How to run a scheduled job scripted in php using windows? I'm using Windows XP sp3.

+1  A: 

Use at or the task scheduler.

You would have to call the PHP interpreter from the command line. In Windows, it is called php.exe. You'll have to find out where it resides, usually in the Programs folder or a sub-directory of your server installation.

The command line for the call will then be something like

"C:\Program Files\Xampp\PHP\PHP.exe" -f "c:\htdocs\my_script_to_run.php"

Note that PHP will probably use a different php.ini file when called this way, and some variables (like $_SERVER["HTTP_HOST"]) are not available. This way of running PHP is called CLI (Command Line Interface).

To determine within a PHP script whether it is being run on the Web server or from the command line, use php_sapi_name().

Pekka
i m using win xp sp-3
Arup
@Arup both `at` and the scheduler are available for you then. Check them out.
Pekka
@Arup also see my updated answer, I added some details.
Pekka