Maximum Execution Time of 30 seconds exceeded
WordPress is one of the most popular and used blogging platform available in the market. If you are a WordPress user, you might have come across a certain set of errors while installing themes or plugins. Maximum Execution Time is one of the most common errors in WordPress. While installing or updating WordPress plugins or themes some of you might have seen the following message on the screen ‘Fatal Error: Maximum execution time of 30 seconds exceeded’ like in the below-mentioned image:
Maximum execution time of 30 seconds exceeded – Cause
I believe that to solve a problem, you should first understand the cause of the problem. WordPress is coded in PHP. There is a time limit set on the web servers which decide for how long the script can run, as in this case for PHP script it’s set to 30 seconds. Whenever you try to install a plugin or theme, it should run within that time limit. If the script is running longer than that, then due to the set time limit, it cut shorts the execution and returns the error as ‘Fatal Error: Maximum execution time of 30 seconds exceeded’. This error is most common for WordPress users as this occurs mostly while installing the plugin or theme.
How to Fix the error Maximum execution time of 30 seconds exceeded
Now we know the cause of the problem, let’s see how we can fix it. The error occurs when the script reaches the maximum execution time as set in PHP or web servers. This means that the running script needs more time for the execution, therefore the solution is increasing the set time limit.
To fix the error we will manually change the maximum execution time limit by writing a small code in .htaccess file.
.htaccess file is a configuration file for use on web servers running Apache Web Server. This file can be configured to enable/disable additional functionality and features offered by Apache Web Servers.
There are number of ways to change the set time limit.
Method 1: Editing the .htaccess file.
- Access the root directory of your website using FTP.
- In the root directory, you will find the file named .htaccess
- Right-click on the file and click view/edit. You will find the file in the below format.
- Press <Enter> after </IfModule> and type the below mentioned code.
- After entering the code, save the file.
php_value max_execution_time 300
Note: The time limit set is 300 seconds (5 minutes). User can change the time limit as per the requirement.
Note: If you are using WordPress on your home computer using XAMPP or WAMP server then you will find the .htaccess via the below-mentioned path.
Navigate to your XAMPP folder > open htdocs > open your WordPress blog folder > .htaccess
Method 2: Editing the wp-config.php file
- Access the root directory of your website using FTP.
- In the root directory, you will find the file named wp-config.php file.
- Right-click and then press edit.
- Enter the code ‘set_time_limit(300);‘ at the bottom of the file.
- Save the file.
Method 3: Editing the php.ini file.
- Access the root directory of your website using FTP.
- Go to the folder wp-admin.
- Find the file named php.ini
- Right-click the file and press Edit.
- Enter the code ‘max_execution_time = 300‘ on the file.
- Save the file.
Note: If php.ini file is not present in the given folder, then create php.ini file. Enter the below mentioned code and save the file.
upload_max_filesize = 64M
post_max_size = 64M
memory_limit = 400M
file_uploads = On
max_execution_time = 300
Method 4: If you are not aware of how to perform any of these tasks, then contact your hosting provider and ask them to make the changes.
By using any of the mentioned methods, you can get rid of the error. Also note, that the mentioned settings may vary based on the web hosting company which you are using.
I hope that this article helped you to fix the error and in the future, you will be able to fix it on your own. Do let me know in the comment section if you like the article and need help with similar issues.
Do share your suggestions from the contact sections. It will help us to improve our services.
If you find the article relevant then don’t forget to share and post the comments for your suggestions and feedback.
For any queries or inquiries do reach out to us via Contact Us page.