WordPress is one of the widely used blogging platforms as well as content management systems. The platform provides the feasibility to extend it according to our needs with the help of various themes and plugins. However; whle uploading certain themes or plugins, updating a theme or a plugin, etc ; you might see an error “maximum execution time of 30 seconds exceed in wordpress” or “maximum execution time of 60 seconds exceeded in wordpress“
In this post, we will go through the various methods through which this problem can be fixed or resolved completely. Inorder to resolve it, we should first understand why the issue is caused. This will help make the exact modifications or makes sense when you apply or do certain changes as we go on in this post.
Why is maximum execution time of 30 seconds in wordpress caused?
WordPress as we know is written in PHP and uses MySQL as database. To protect web servers from abuse, a limit is being set for how long a php script should run. A few webhosting service providers set this limit to a higher level while others set it to a lower level. If you are using a shared hosting service for your WordPress blog and if they have set the limit to a lower value, there might be a chance of witnessing this error at one point or the other.
How to solve maximum execution time of 30 seconds exceeded in executing specific line of php code?
As said earlier, there are various ways through which this error can be fixed. Some of these methods include editing .htaccess file, using a plugin, by changing wp-config.php file or by changing php.ini file. Let us discuss about all of these solutions and how they work.
Note: Only one of the solutions can help you fix the error and there is no need of applying or doing all of them. Also, if you are making any changes to your files; do have a copy or backup before proceeding further.
Changing or editing wp-config.php file
Your wp-config.php file contains some sensitive information. Have a copy before you make changes to it so that any accidental changes might be revoked. You can edit this wp-config.php file directly through cpanel in your hosting provider or connect to your webhost through an ftp program like filezilla.
After getting connected to the file or logging into your cpanel, add set_time_limit(60); before the line “/* That’s all, stop editing! Happy blogging. */” found in wp-config.php file.
Editing .htaccess file manually
Connect to your site using an ftp client that you are comfortable working with & find .htaccess file. The .htaccess file is usually located in /wp-content/ and /wp-admin/ folders. Now, add the following line to your .htaccess file
php_value max_execution_time 300
The above code will change the time of execution which is defined by default to your defined value.You can also try changing the number 300 to a higher value if the error still persists.
By using a plugin
Editing .htaccess file means a little bit of technical stuff should be handled. This includes connecting ftp client,. changing the code carefully. If you are not comfortable with that process, install wp maximum execution time exceeded plugin. The installation of the plugin will change the default values without any hassles.
By changing php.ini file
Change max_execution_time = 30 ; to max_execution_time = 60 ; in the php.ini file.
The amount of time limit should and can be exceeded to a certain limit if the values provided in the examples do not solve the problem. One of the above should help you in fixing maximum execution time of 30 seconds exceeded or maximum execution time of 60 seconds exceeded errors in wordpress.
Do the above solutions fix the problem? If you face any further issues, do use the comment sections below and I would be happy to help you further.