Home > Article > Backend Development > set_time_limit — Set the maximum script execution time
(PHP 4, PHP 5)
set_time_limit — Set the maximum execution time of the script
void set_time_limit ( int $seconds
)
Set the time the script is allowed to run, in 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, 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 25 seconds are set in the script, such as set_time_limit(20). Then, the script can run for a total of 45 seconds before timing out.
seconds
Maximum execution time , the unit is seconds. If set to 0 (zero), there is no time limit.
No return value.
Note: set_time_limit()The function and configuration directive max_execution_time only affect the execution time of the script itself. The maximum time for any script execution that occurs such as system calls using system(), stream operations, database operations, etc. is not included when the script is already running. In Windows, where measured times are real-valued, this is not the case. Related articles: php page maximum execution time set_time_limit function does not work php set_time_limit() sets page execution Time php set_time_limit(0) Function to set program execution time