开发者

CRON jobs in php deployed in windows platform

开发者 https://www.devze.com 2022-12-24 18:15 出处:网络
How to run a sc开发者_如何学Goheduled job scripted in php using windows?I\'m using Windows XP sp3.Use at or the task scheduler.

How to run a sc开发者_如何学Goheduled job scripted in php using windows? I'm using Windows XP sp3.


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().


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).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号