Home  >  Article  >  Backend Development  >  Detailed explanation of php scheduled execution task settings, detailed explanation of php tasks_PHP tutorial

Detailed explanation of php scheduled execution task settings, detailed explanation of php tasks_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:07:41934browse

Detailed explanation of php scheduled execution task settings, detailed explanation of php tasks

A buddy asked me this question today. The problem is that he has an IIS server and needs to execute a scanning php script regularly. How to do this? It is executed once every hour. Here are the settings for Windows

1) Double-click Task Scheduler in the Control Panel to open the Windows Task Scheduler window.

2) Double-click to add a task to open the task planning wizard. Click Next.

3) Click to browse and select the program you want to run

4) Enter the plan name and select Daily

5) Set the starting time, select each day, and the starting date. Next step.

6) Enter the password, which is the password of the user name of the system (use default). Next step

7) Choose to open the advanced properties of this task when you click Finish.

8) In the advanced properties window, select the Schedule tab and select Advanced

9) In the advanced planning options, check the recurring task and set the duration to 24 hours.

10) It can be updated once an hour and work 24 hours a day.

Then we continue to solve how to support the scheduled execution of scripts, so we need to write a script, such as test.bat

I installed php to the D drive, using php-cgi.exe

Copy code The code is as follows:

D:
cd php
php.exe D:/wwwroot/dingshi.php //The path of the script file for scheduled execution

We can test dingshi.php

Copy code The code is as follows:

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

Let’s double-click test.bat, and then check whether a.php has written test. The program our scheduled task runs is test.bat, so it will be executed automatically!

The above is the setting method for php scheduled execution tasks. It is very simple. Friends can expand it freely. I hope you will like it

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/954666.htmlTechArticleDetailed explanation of php scheduled execution task setting, detailed explanation of php task Today a buddy asked me this question, the problem is like this There is an iis server that needs to execute a scanning php script regularly. This...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn