Get the App
SLTechnology News&Howtos  ›  Development  › 

How to set the timeout by php.ini

Shulou Source: shulou.com Published: 2022-06-03 09:54:29 09月21日 Update

This article mainly introduces how to set the timeout in php.ini. It is very detailed and has certain reference value. Friends who are interested must finish reading it.

Set the timeout method: 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 change the value of the item to the required time value.

Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer

The default maximum execution time in php.ini is 30 seconds, which is specified by the max_execution_time variable in php.ini. If you have a task that takes a long time to complete, such as sending a lot of emails to a large number of recipients, or doing heavy data analysis work, the server will forcibly abort the executing program after 30 seconds, how to solve this problem?

You only need to change 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 change the value of the item to the required time value. Example

Max_execution_time = 1800

Of course, we can also use the PHP function to modify:

1. Use the ini_set ("option", "value") function

Ini_set (''max_execution_time'',''180'')

2. Using the set_time_limit () function

Add at the beginning of the php document

Set_time_limit / / represents a timeout of 100s and above is all the content of the article "how to set the timeout in php.ini". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Time file function configuration content method directory article work search longest heavy representative value interest variable boy buddy tutorial data Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Shulou Tech Info Redmi OPPO Reno Shulou Technology