How to remove 30 seconds response in php

藏色散人
Release: 2023-03-17 13:50:01
Original
1323 people have browsed it

php method to remove 30 seconds response: 1. Modify "max_execution_time" in php.ini; 2. Add "set_time_limit(100);" at the top of the program; 3. Modify the default PHP request to the end cycle.

How to remove 30 seconds response in php

The operating environment of this tutorial: Windows 7 system, PHP version 8.1, Dell G3 computer.

php How to remove the 30 second response?

Solution 1:

Modify max_execution_time in php.ini

Find the file php.ini, and then find in this file: max_execution_time = 30; In this line, set the number 30 to the value you want, in seconds. (It can also be modified directly to: max_execution_time=0; // no limit) Note that you need to restart the server after making this modification.

Solution 2:

Timeout set_time_limit(0)

Add: set_time_limit(100); at the top of the program; it means that the maximum execution time is set to 100 seconds, of course The parameter can be set to 0, which means the same as above. Special description of the set_time_limit function: void set_time_limit (int $seconds) The function of this function is to set the time allowed for the script to run, in seconds.

If this setting is exceeded, the script returns a fatal error. The default value is 30 seconds, or the value defined in max_execution_time in php.ini, if this value exists. When this function is called, set_time_limit() restarts the timeout counter from zero. In other words, if the default timeout is 30 seconds and set_time_limit(20) is called when the script has been running for 25 seconds, then the total time the script can run before timing out is 45 seconds. This feature does not take effect when php is running in safe mode. There is no other way than turning off safe mode (setting safe_mode to off in php.ini) or changing the time limit in php.ini. Case: If safe mode is not turned on, set the program running time to 25 seconds. For example:

if(!ini_get('safe_mode')){
    set_time_limit(25);
}
Copy after login

Solution 3:

The default period from a PHP request to the end is 30S, and the memory limit is 128M php.ini can change the parameters~ ~

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of How to remove 30 seconds response in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
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