简体   繁体   中英

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

你打电话

php.exe cronjob.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM