We are often facing this issue on localhost or remote server
"Fatal error: Maximum execution time of 120 seconds exceeded in".
OR
"Fatal error: Maximum execution time of 30 seconds exceeded in".
Here i got the solution. One of these methods can help us to remove this error.
Method 1.
We need to change that in the php.ini file for maximum execution time in 500 seconds:
max_execution_time = 500
or in our php file add this code:
set_time_limit(500);
Method 2.
Update these values in your php.ini file
max_execution_time = 360 ;Maximum execution time of each script, in seconds (I CHANGED THIS VALUE)
max_input_time = 120 ;Maximum amount of time each script may spend parsing request data
max_input_nesting_level = 64 ;Maximum input variable nesting level
memory_limit = 128M ; Maximum amount of memory a script may consume (128MB by default)
Method 3.
We can also use a simple way to avoid it in some cases.
Just put this command in the begining of your php script:
set_time_limit(0);
Method 4.
If we are using wordpress. By default WordPress limits the maximum execution time to 30 seconds. Add the following code to your .htaccess file on your root directory of your WordPress Installation to over-ride the default.
php_value max_execution_time 300 //where 300 = 300 seconds = 5 minutes
Method 5.
We can also solve this issue by updating .htaccess file.
<IfModule mod_php5.c>
php_value post_max_size 200M
php_value upload_max_filesize 200M
php_value memory_limit 300M
php_value max_execution_time 259200
php_value max_input_time 259200
php_value session.gc_maxlifetime 1200
</IfModule>
Method 6.
We can remove the restriction by seting it to zero by adding this line at the top of our php script :
<?php ini_set('max_execution_time', '0'); ?>
OR
// Set maximum execution time to 500 seconds this way
ini_set('max_execution_time', 500);
// or this way
set_time_limit(500);

Thanks. Method 1 and Method 6 are worked for me.
ReplyDelete