Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 925
windowsdummy Avatar asked Dec 05 '22 03:12

windowsdummy


1 Answers

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.

like image 69
Greg Ellis Avatar answered Dec 07 '22 18:12

Greg Ellis