: This article mainly introduces the PHP script execution timeout solution. if you are interested in the PHP Tutorial, please refer to it. PHP default script execution timeout is 30 seconds, which is caused by php. if the max_execution_time variable in ini is specified, the server will forcibly stop the program being executed after 30 seconds. to execute a script with a running time greater than 30 seconds, you can solve the problem by using the following methods:
Modify the execution time limit of php. ini scripts
Edit php. ini and modify the max_execution_time value:
Max_execution_time= 500
// You need to reload php. ini and restart the web server to make the modification take effect.
Set the script execution time through the. htaccess file
Php_value max_execution_time 500
Set the maximum execution time in the script
Ini_set ('max _ execution_time ', 500 );
Cancel the script time limit using php functions
Set_time_limit (0 );
Set_time_limit is used to set the script time-out time. this function specifies that the program must end in the specified number of seconds from the time of running the sentence. if the time-out occurs, the program exits with an error.
Usage: set_time_limit (seconds );
// When the number of seconds is 0, it indicates that the script has no time limit.
The above describes the PHP script execution timeout solution, including the content, hope to be helpful to friends who are interested in the PHP Tutorial.