I am beginner in Windows Server, i had setup my project on windows servers as per client requirement but i am suffering a serious problem that is my client want to upload file parallel on same time with different user on same website and i am also verify the email from uploaded file on server. That is way I want to make a scheduler like cron
. Any one who has knowledge about how to make scheduler for cron
in PHP on Window Server not xampp
.
问题:
回答1:
Assuming that you need to execute some of your controller methods to do some housekeeping work, you need to set up a cron
job (at, say, every 30 minutes). For this, you use task scheduler from Windows.
You configure frequency and everything, then comes the point where you set which command to run. Here, you need to download wget for windows.
You will enter the execution command like this:
C:\WINDOWS\wget.exe -q -O nul http://yoursite/controller1/method1
If you just want to run a page, then modify as per:
C:\WINDOWS\wget.exe -q -O nul http://yoursite/somepage.php
回答2:
Run a infinite loop in your another long-term running program, which is basically run-php + sleep
. (As for me, I have a python program listing socket so it is proper for use.)
- want more flexible and not use windows task scheduler, so your program can be easily deploy to a new computer
- want more flexible time scheduler (like run it after 1min then after 2min then 1min)
I know it is not the most commonly seen solution, but it suits some special usage like me. :)
One more tip:
Laravel
or other frameworks have a strong support for time-schedule. If you have complex demand, you can use them.