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.
- How To Use the AT Command to Schedule Tasks (seems to require login now - wtf?)
- Alternative: Wikipedia on AT
- How To Schedule Tasks in Windows XP
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
2010-03-22 10:28:23
i m using win xp sp-3
Arup
2010-03-22 10:37:44
@Arup both `at` and the scheduler are available for you then. Check them out.
Pekka
2010-03-22 11:12:54
@Arup also see my updated answer, I added some details.
Pekka
2010-03-22 11:18:44