Home > Backend Development > PHP Tutorial > php Fatal error: Maximum execution time of 30 seconds exceeded in problem solution

php Fatal error: Maximum execution time of 30 seconds exceeded in problem solution

WBOY
Release: 2016-08-08 09:30:42
Original
1899 people have browsed it


php Fatal error: Maximum execution time of 30 seconds exceeded in Solution to the problem:

Reprinted from: www.alixixi.com/program/a/2011110575885.shtml

This error refers to your php
execution time The maximum execution time of 30 seconds set in the configuration file has been exceeded. This is not a problem with your program itself, but a problem with the system's configuration file. If your network speed is fast, this may not happen if you execute it again. This is an error, but if this problem occurs, you can also make certain modifications. There are three methods:
1. Modify the php configuration file and find the php.ini file. It should generally be placed in your C:WINDOWS directory. Down, and then find

max_execution_time = 30; //Set to the value you want, the unit is seconds



this line, this is the maximum execution time set to 30 seconds, you can modify this value, change for your expectations. (It can also be set directly to: max_execution_time = 0)


2. Use the ini_set() function. Not everyone can modify the php.ini file, so you can use this function to change your maximum execution time limit value. For example:

ini_set('max_execution_time', '100');

is set to 100 seconds. You can also set it to 0, which means there is no limit to the execution time.
3. Use the set_time_limit() function, set_time_limit(20) means the maximum execution time plus 20 seconds, but if PHP is executing in safe mode, set_time_limit() will have no results unless you use the first method.


The following is a partial explanation: set_time_limit --- Limit the maximum execution time set_time_limit (PH3, PHP4) set_time_limit --- Limit the maximum execution time Syntax: void set_time_limit (int seconds) Description: Set the allowed execution time of a program Number of seconds. If the time limit is reached, the program will return an error.

The default limit time is 30 seconds. The value of max_execution_time is defined in the structure file (called php3.ini in PHP3 and php.ini in PHP4). If the seconds are set to 0, it means there is no time limit. limits.

When calling this function, set_time_limit() will restart the calculation of the maximum execution time from zero. That is to say, if the maximum execution time is the default 30 seconds, and calling this function set_time_limit(20) If it took 25 seconds to execute the program, the maximum execution time of the program will be 45 seconds.

Note: When PHP is running in safe mode, set_time_limit() will have no results unless safe mode is turned off or the structure file is modified (called php3.ini in PHP3 and php.ini in PHP4) time limit.

The above introduces the solution to the problem of php Fatal error: Maximum execution time of 30 seconds exceeded in, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

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