Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set the maximum php connection time

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report