How to set the maximum php connection time
This article mainly introduces how to set the maximum php connection time, the article is very detailed, has a certain reference value, interested friends must read it!
The largest way to set the php connection time: 1, set max_execution_time;2 in php.ini, set through the ini_set function of PHP; 3, set through the set_time_limit function.
Operating environment of this article: Windows7 system, PHP7.1 version, Dell G3 computer
How to set the maximum php connection time?
Three methods of setting the maximum execution time of script by PHP
The default maximum execution time in php.ini is 30 seconds, which is specified by the max_execution_time variable in php.ini. If the script needs to run for a long time, such as sending a large number of emails, or analyzing a large amount of data, the server will forcibly abort the executing program after 30 seconds. In this case, you have to change the maximum execution time of the php script.
Three methods of setting the maximum execution time of script by PHP
1. Set it in php.ini
Max_execution_time = 120
2. Set it through the ini_set function of PHP
Ini_set ("max_execution_time", "120")
3. Set through the set_time_limit function
Set_time_limit (120)
If the above numbers are set to 0, there is no limit, and the script will be executed until the end of execution.
Therefore, for scripts that need to be executed for a long time, you can usually add the following code at the beginning of the php code
Set_time_limit (0); the above is all the contents of the article "how to set the maximum php connection time". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!