Programmer-how to regularly execute a PHP program without the scheduled tasks on linux or windows?

Source: Internet
Author: User
How to regularly execute a PHP program without the scheduled tasks on linux or windows? How to regularly execute a PHP program without the scheduled tasks on linux or windows?

Reply content:

How to regularly execute a PHP program without the scheduled tasks on linux or windows?

If you do not need an external timer, you can only use the following two methods.
1. Start a php process and keep running in the background. Make a timer to check whether there are any tasks that should be executed.
2. Events are triggered by the user at the front-end. If the user accesses the event, check whether there are any tasks to be executed.

Ps. Under what circumstances will this egg pain need be met?

For php pages (that is, you can access them through the web), you can use third-party web page monitoring. The minimum time is five minutes.

Otherwise, I cannot figure out which environment I can use crontab.

Php cannot be resident in memory unless you are running in the command line. Therefore, if php is run in web mode, this function cannot be implemented.

Our wonderful practice is to use the automatic refresh function of the digital browser ..

Ignore_user_abort (); set_time_limit (0 );

In the program, when the while (true) endless loop and the Judgment time are reached, it will be executed.
To facilitate control, you can read a file. If the file is 0, exit. You can modify the file content to control the process termination.

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.