PHP timed to perform task setup detailed

Source: Internet
Author: User
Tags php script

This article mainly introduces the PHP time to perform task Setup method, very simple, there is a need for small partners under the reference.

Today, a buddy of mine asked me this question. He has an IIS server that is scheduled to execute a scanned PHP script, this How to do it every hour, the following is the settings of Windows

1 in Control Panel, double-click the Task Scheduler to open the Windows Task Scheduler window.

2 Double-click Add Task, open Task Scheduler Wizard. Click Next.

3) Click Browse, select the program to run

4 Enter the plan name and choose Daily

5 Set start time, select Daily, start date. Next.

6 Enter the password, which is the password for the system's username (by default). Next

7 Select to open advanced properties for this task when the click completes.

8 in the Advanced Properties window, select the Schedule tab and select the Advanced

9 The Advanced Plan option, tick the repeat task, duration: set to 24 hours.

10 can be up to an hourly update, 24 hours a day to work.

Then we continue to work on how to support the timed execution of the script, so we're going to write a script like Test.bat

My PHP installed to D disk, with the Php-cgi.exe

The code is as follows:

D:

CD PHP

Path to Php.exe d:/wwwroot/dingshi.php//timed script files

We can test dingshi.php.

The code is as follows:

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

We double-click Test.bat, and then look at the a.php is not written to test, our scheduled task to run the program is Test.bat this will automatically execute!

The above is the PHP time to carry out the task of the set method, very simple, small partners free expansion on it, I hope you can enjoy

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.