Home>Article>Backend Development> How to set the timeout in php.ini

How to set the timeout in php.ini

青灯夜游
青灯夜游 Original
2021-09-26 11:44:22 2750browse

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.

How to set the timeout in php.ini

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. Useini_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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn