How to set the timeout: 1. Enter the PHP installation directory, find and open the configuration file "php.ini"; 2. In the configuration file, search for the "max_execution_time" item, and modify the value of this item to Just the required time value.
The operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
The default longest execution in php.ini The time is 30 seconds, which is specified by the max_execution_time variable in php.ini. If you have a job that takes a long time to complete, such as sending many emails to a large number of recipients, or performing heavy data analysis work , the server will forcibly terminate the executing program after 30 seconds. How to solve this problem?
You only need to modify the value of max_execution_time and set the timeout. The setting method is as follows:
1. Enter the PHP installation directory, find and open the configuration file "php.ini"
2. Search for the "max_execution_time" item in the file, and modify the value of this item. is the required time value. Example
max_execution_time = 1800;
Of course we can also use PHP functions to modify:
1. Use ini_set("option", "value")
function
ini_set(''max_execution_time'',''180'');
2. Use the set_time_limit() function
and add
set_time_limit(100) //代表为100秒超时
at the beginning of the php document. Recommended learning: "PHP Video Tutorial"
The above is the detailed content of How to set the timeout in php.ini. For more information, please follow other related articles on the PHP Chinese website!