Home > Article > Backend Development > Maximum execution time of 30 seconds exceeded_PHP tutorial
Maximum execution time of 30 seconds exceeded error solution.
A brief summary of the solution:
Error 1: The memory exceeds the limit. I forgot the specific error statement. Please briefly explain the solution.
Use loop to import in batches;
Use the sleep(5); statement at the beginning of each loop to delay execution to prevent the server memory from occupying too much at the same time and modify the data inside;
At the end of each loop, ob_flush(); is used to refresh the output buffer
flush(); Send all the output of the program so far to the user’s browser
Both must be used at the same time to flush the output buffer www.2cto.com
Error 2: Maximum execution time of 30 seconds exceeded error (Maximum execution time of 30 seconds exceeded)
Solution:
Method 1, modify the php.ini file
max_execution_time = 30; Maximum execution time of each script, in seconds
Just set it to the required value. If set to 0, it will never expire.
Method two, modify the php execution file
Add
set_time_limit(0);
?>
max_execution_time = 30; Maximum execution time of each script, in seconds
Just set it to the required value. If set to 0, it will never expire.