PHP Fix: Maximum execution time of 30 seconds exceeded – WordPress

While playing with WordPress PHP content management system(CMS) on my XAMPP local server, i encountered a Maximum execution time error while trying to install a plugin.

Fatal error: Maximum execution time of 30 seconds exceeded in C:\xampp\htdocs\rainbowcreed\wp-includes\class-http.php on line 1153

Don’t even bother checking line 1153 in “class-http.php” as that is not where the problem lies. i knew from the error message that i need to increment the value of max_execution_time in php.ini ( C:/xampp/php/php.ini ) usually having a default value of 30.

Restart Apache for the changes to take effect.

This problem doesn’t happen only in WordPress as it peculiar to PHP. therefore, incrementing the php.ini max_execution_time value is the solution.

If you are on a shared web hosting, you might not be granted access to php.ini file. if that is the case, add this set_time_limit(0); to the header of the PHP web app.
leaving the value of “set_time_limit” to “0” means no time limit is imposed. while for example set_time_limit(45); means the number of seconds the script is allowed to run is 45 seconds.

If you are running WordPress on a shared web host without an access to php.ini, goto /wp-includes/class-http.php and simply add say set_time_limit (45); before the initial PHP class and save. that should solve the problem.

To check if the new set_time_limit value has been set or not, simply run


 <?php
 echo ini_get('max_execution_time');
?>
 
Don’t miss out!
Subscribe to My Newsletter
Invalid email address