Fatal error: Maximum execution time of 30 seconds exceeded

I ran into this problem while upgrading to WordPress 4.0. 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

I had the same problem and solved it by changing the value for the param max_execution_time in php.ini, like this:

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)

I hope this could help you.


Your loop might be endless. If it is not, you could extend the maximum execution time like this:

ini_set('max_execution_time', '300'); //300 seconds = 5 minutes

and

set_time_limit(300);

can be used to temporarily extend the time limit.


All the answers above are correct, but I use a simple way to avoid it in some cases.

Just put this command in the begining of your script:

set_time_limit(0);

Tags:

Php

Json