How to set the timeout in php.ini

青灯夜游
Release: 2023-03-13 06:04:01
Original
2868 people have browsed it

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;
Copy after login

Of course we can also use PHP functions to modify:

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

ini_set(''max_execution_time'',''180'');
Copy after login

2. Use the set_time_limit() function

and add

set_time_limit(100)  //代表为100秒超时
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template