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 modify the maximum time of php

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

Share

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

In this article, the editor introduces in detail "how to modify the maximum time of php", the content is detailed, the steps are clear, and the details are handled properly. I hope that this "how to modify the maximum time of php" article can help you solve your doubts.

The method to modify the maximum time of php: 1, set "max_execution_time = 120;" in php.ini; 2, set through the ini_set function of PHP; 3, set it through the set_time_limit function.

This article operating environment: Windows7 system, PHP7.1 version, Dell G3 computer.

How to modify the maximum time of php?

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); read here, this article "how to modify the maximum time of php" article has been introduced, want to master the knowledge of this article still need to practice and use in order to understand, if you want to know more related articles, 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