Solution for WordPress PHP Error “Maximum execution time of 30 seconds exceeded”
Did you just noticed that few plugins like “Automatic WordPress Backup” or other important plugins are not working properly on your WordPress setup? If the error log of those plugins or the log on your server is having the PHP Fatal error message as “Maximum execution time of 30 seconds exceeded in executing specific line of PHP code”, then here is the way to resolve this problem.
Actually few days ago, I checked the Amazon S3 backup plugin “Automatic WordPress Backup” which I use to take regular backup of my website. And I saw that there is no backup taken since last few days and even the few stored backups are already deleted from the S3 bucket. It was shocking for me even when I take more than one backup of my site data and keep them on different places. As it is much easier to restore a site from Amazon S3 secured and smooth backup taken by this plugin, I was upset and started finding the cause of this problem.
[ad id='15' style='margin:10px 0;']
Once I check the error log of the plugin, I found an error message as “Maximum execution time of 30 seconds exceeded” in executing specific line of PHP code of this plugin only. So there was a need to increase the default or set maximum time for execution of a process on my server.
There are few ways to increase the execution time for an initiated process. Either you can increase that by adding a line in wp-config.php or HTACCESS or php.ini file hosted on your web server. There is no need to make all three changes as any one of these works fine. That means, it is up to your convenience to choose any one of these three ways to increase the set maximum execution time for your server. For WordPress, it is much easier to do that by changing Wp-config.php file which is available in the root of the installation.
1. By Wp-config.php Changes
Important – If you are making changes in wp-config.php, then add this line above “/* That’s all, stop editing! Happy blogging. */” comment.
2. In htaccess
php_value max_execution_time 60
3. Addition in php.ini file
max_execution_time = 30 ;
By default, the maximum execution time on web servers remains at 30 seconds. You can change that amount to provide more time for certain executions on your server. For example, in above codes I changes that value to 60 seconds.
Once I made the change in wp-config.php file stored in the root location of the WordPress installation and uploaded the file, the plugin started working. In case after this change, you are seeing another error related to the “Allowed Memory Size of certain bytes exhausted” then read this post to resolve that as well.
Did you find this post helpful? Post your queries and feedback through comments.