Home > Backend Development > PHP Problem > Why doesn't php limit execution time?

Why doesn't php limit execution time?

青灯夜游
Release: 2023-03-12 18:06:02
Original
4178 people have browsed it

In PHP, you can use the set_time_limit() function to limit the execution time. This function can set the maximum execution time of the script file. When the parameter value is set to 0, the script can be executed without limit; syntax " set_time_limit(0)".

Why doesn't php limit execution time?

The operating environment of this tutorial: Windows 7 system, PHP version 7.1, DELL G3 computer

In PHP, you can use the set_time_limit() function There is no limit on execution time. Just set the following code:

set_time_limit(0);
Copy after login

set_time_limit - Set the maximum execution time of the script, The unit is seconds. If this setting is exceeded, the script returns a fatal error. The default value is 30 seconds, or the value defined in max_execution_time in php.ini, if this value exists.

When this function is called, set_time_limit() will restart the timeout counter from zero. In other words, if the default timeout is 30 seconds and set_time_limit(20) is called when the script has been running for 25 seconds, then the total time the script can run before timing out is 45 seconds.

If you set the parameter value of the set_time_limit() function to 0 (zero), there is no time limit and the program can be executed without limit.

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of Why doesn't php limit execution time?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template