Php scheduled task execution-php Tutorial

Source: Internet
Author: User
Php scheduled task execution today, a buddy asked me this question. The problem is that he has an iis server and needs to regularly execute a scanned php script. how can this problem be solved, run the command once every hour. The following are windows settings.

1) double-click the task scheduler in the control panel to open the Windows Task Scheduler window.

2) double-click add task to open the Task Scheduler wizard. Click next.

3) Click browse and select the program to run

4) enter a scheduler name and select Daily

5) set the start time, day, and start date. Next step.

6) enter the password, which is the user name (by default) of the system. Next Step

7) click finish to open the advanced properties of the task.

8) in the advanced properties window, select the schedule tab and advanced

9) in the advanced plan option, select "repeat task". Duration: Set to 24 hours.

10) it can be updated every hour, working 24 hours a day.

Then we will continue to solve how to support the regular execution of scripts, so we will wait for a script to be written, such as test. bat.

I used php-cgi.exe to install PHP on the D drive.

D: cd phpphp.exe D:/wwwroot/dingshi. php // path of the script file that is periodically executed

We can test dingshi. php.

File_put_contents ("a. php", "test ");

Double-click test. bat and check whether a. php has written test. the program running in our scheduled task is test. bat, which will be automatically executed!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.