Define a PHP cron job on a Windows 2003 server

I am using Windows Server 2003, IIS6, php and mysql. I have a problem installing cronjob using the built-in schedule task function in Windows OS.

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

  • Add "new schedule task"

  • He asks me to choose a program. Should I choose php.exe or Internet explorer because php files run in an internet browser? How can I call certain php files (suppose the file name is cronjob.php)

I need your guys. Please inform.

+4
source share
3 answers

if you want to run a scheduled task every minute, you must configure it using the command as shown below:

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 allow you to run a task every minute. I do not know how to do this for the task scheduler, but I just wanted to share this solution.

+11
source

You will need to call php.exe as an interpreter with the path to the script as an argument, for example:

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

That should work.

+3
source

You call

 php.exe cronjob.php 
+2
source

Source: https://habr.com/ru/post/1302197/


All Articles