开发者

Set PHP cron job on windows server 2003

I am using Windows server 2003, IIS6, php and mysql. I have a problem setting the cronjob using built in schedule task feature in Windows OS.

  • Start > Programs > Accessories > System Tools > Schedule Tasks

  • Add "new schedule task"

  • It a开发者_如何学Pythonsks me choose programs. Should I choose php.exe or internet explorer, because php files run on internet browser right? How do I call the specific php files (assume the name of the file is cronjob.php)

I need your guys help. Please advise.


if you would like to run the scheduled task every minute you have to set it up through the command like as follows:

schtasks /create /sc minute /mo 1 /tn "my task" /tr "C:\Program Files\php5\php.exe c:\wwwroot\inetpub\website\myfile.php?task=fetch"

This will let you run the task each minute. There is no way to do this through to the task scheduler gui to my knowledge so I just wanted to share this solution.


You'll need to call php.exe as the interpreter with the path to the script as its argument, example:

"c:\program files\php5\php.exe" c:\cronscripts\cronjob.php

That should work.


You call

php.exe cronjob.php
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜