When updating a WordPress plugin or theme, you may face the ‘Fatal error: Maximum execution time of 30 seconds exceeded’ error. As the name itself suggests, this error means that a code has taken more time in execution than it should. There is a maximum time limit for the execution of a code in WordPress set by your WordPress hosting server. Crossing this limit is not allowed, in general, to prevent the abuse of server resources.
If the term Fatal Error scares you, there is no need for that. The error of exceeding the maximum execution time is named fatal, but it is one of the most common errors in WordPress. Now that you have come across this error in your WordPress website, we will help you in resolving it. All you have to do is to go through this article and follow the solutions.
Causes of the Fatal Error: Maximum Execution Time Exceeded in WordPress:
Most hosting companies allow a PHP script a maximum execution time of between 30 – 60 seconds. This time limit is to set how long a PHP script can run. This time limit is enough for a reasonable PHP script to execute. On reaching the time limit, which may vary for different hosting companies, the error of exceeding the maximum execution time may appear on your WordPress website.
Error Message:
As a part of the fatal error protection feature in WordPress 5.2, the below error message may appear to your website visitors.
Fixing the Fatal Error: Maximum Execution Time Exceeded in WordPress:
Resolving the error of exceeding the maximum execution time in WordPress is not as tough as it may appear to be. When this error occurs, there are some other events associated with it. One of these is an email sent to your email account. This email will contain the details if it is a plugin that caused the issue and which plugin is the one that triggered the error.
Method 1:
Now that you have received this email from WordPress, you can follow the below steps to resolve the error of exceeding the maximum execution time in WordPress:
- Go to the email received from WordPress.
- Locate the link to resolve the error.
- Log in to WordPress with ‘Recovery mode’.
- Deactivate or delete the error-causing plugin.
Method 2:
You can also fix the actual issue instead of deactivating or deleting the plugin. For this, you need to follow the below steps:
- Use an FTP Client to connect to your website.
- Go to your /wp-content/ or /wp-admin/ folders.
- Locate your .htaccess file.
- If you can’t locate the file, you can take help from a tutorial on the same.
- If your FTP client is FileZilla
- Go to the ‘Remote Site’ section in the right-hand column.
- Locate your .htaccess file.
- After locating the .htaccess file, right-click. A menu will appear.
- Open the ‘View/Edit option.
- The .htaccess file will open in a text editor.
- Add the below code at the bottom of your .htaccess file:
php_value max_execution_time 300
- Save your file.
- Your maximum execution time is now set as 300 seconds or 5 minutes.
- Reconnect to your WordPress website.
- The error might probably be resolved.
- If not, set the value of the maximum execution time to 600.
- In general cases, the error should be resolved by this.
Method 3:
If you don’t want to go with the above two methods, you can modify your php.ini file to resolve the error of exceeding the maximum execution time in WordPress. The PHP settings on your server are defined by this configuration file.
To resolve the error of exceeding the maximum execution time in WordPress with the php.ini file, you can follow the below steps:
- Locate the php.ini file inside your WordPress folder.
- Create a new php.ini file inside your WordPress root folder, if it is not already present.
- Edit the php.ini file.
- Add the below code.
max_execution_time = 60
- Save the changes.
- Upload the changes back to your server.
- Reconnect to your WordPress website.
- The error should be resolved by this.
If all the above methods fail, take help from your WordPress hosting provider. You can also check our other articles on different WordPress errors.