Do you see the WordPress max_execution_time fatal error on your screen when updating WordPress themes or plugins? You will likely experience this issue if a PHP script takes much time to execute and reaches the maximum time limit. The time limit is crucial since it allows WordPress sites to protect server resources against misuse and other issues.
This blog post will discuss fixing the WordPress max_execution_time fatal error in WordPress.
Why Do You See the max_execution_time Error on Your Screen?
Users witness the max_execution_time error on their screens when the PHP script on the WordPress website takes more than the allowed time. PHP, the programming language, has a time limit indicating how long a script takes to run. This limit is handy when protecting web servers from potential misuse and issues.
Web hosting service providers implement different time limits but often apply a 30——to 60-second limit. If a PHP script takes more than the allowed time, a maximum execution time exceeded error occurs.
How to Fix max_execution_time Error?
The max_execution_time error, or the maximum execution time exceeded error, is one of the common WordPress errors that are easily fixable. This section will discuss various troubleshooting methods that let you resolve this annoying WordPress error. These troubleshooting methods include:
- Use WordPress Recovery Mode
- Edit the .htaccess File
- Modify the php.ini File
- Edit the wp-config.php File
- Optimize the WordPress Database
- Check the WordPress Plugins
Use WordPress Recovery Mode
When the WordPress max_execution_time error occurs, you may likely see the ‘The site is experiencing technical difficulties’ error message. This error message denotes the fatal error protection feature, part of WordPress 5.2.
Moreover, users can get emails informing them which WordPress plugins are behind the max_execution_time error. The email has a unique link that helps you log in to WordPress via ‘Recovery Mode.’ This way, you can deactivate or remove the plugin that has caused this WordPress error.
Edit the .htaccess File
You can edit the .htaccess file and add a simple code to bypass the WordPress max_execution_time fatal error. To edit the .htaccess file, visit your root directory using the file manager. The web hosting service company or an FTP client usually provides you with the file manager. We will use the FTP client to edit the .htaccess file in this case. Follow the below steps to edit the .htaccess file in WordPress:
- Log into the FTP client, go to the ‘public_html’ folder, and find the .htaccess file.
- You should right-click and then press the ‘View/Edit option to access the file in the text editor.
- Save the .htaccess file after adding the below code at the bottom of it:
php_value max_execution_time 300
This code allows you to reset the maximum execution time to 5 minutes (300 seconds). You should revisit the WordPress site to see if this fatal WordPress has disappeared. Fortunately, editing the .htaccess file in WordPress lets you control, secure, and optimize website redirects.
Modify the php.ini File
To remove the WordPress max_execution_time error, you can modify the php.ini file, which explains the PHP settings on your server. To do this, create a new php.ini file inside the WordPress root folder. You can access the WordPress root folder using the FTP client. Once you access it, edit the php.ini file and include the below line:
max_execution_time = 60
You must save the file and revisit your website to check if this error persists.
Edit the wp-config.php File
Editing the wp-config.php file allows you to improve the maximum execution time of a website. Therefore, you can edit the wp-config.php file when removing the fatal WordPress max_execution_time error. You must access your WordPress root directory via an FTP client. Once you access the root directory, find the wp-config.php file and open it for editing.
At this point, you should paste the below line before the line that highlights. That’s all; stop editing! Happy blogging:
define(‘WP_MAX_EXECUTION_TIME’, 300); //Replace 300 with your desired time in seconds
This line refers to the custom maximum execution time for a WordPress website. You should use 300 to check if this fatal error has disappeared.
Optimize the WordPress Database
A haphazard database can hamper the site’s speed and may result in the maximum execution time needed error. Therefore, you must optimize your database, enhancing your site’s performance by removing the unneeded database.
To optimize the WordPress database, you can use the WP-Optimize plugin. With this caching and optimization plugin, you can significantly improve your site’s speed and performance. Once you install and activate the plugin, you can optimize database tables, remove spam comments, clean all auto-draft posts, etc.
Check the WordPress Plugins
WordPress plugins help improve the website functionality but can sometimes lead to max_execution_time errors. Thus, you should check and deactivate the problematic plugins as early as possible. If you are a WordPress owner, ask your WordPress developer to deactivate the WordPress plugins and check if this fatal error has disappeared.
If you successfully remove the max_execution_time error, there is a problem with one of your plugins. Fortunately, removing poorly coded plugins helps you eliminate the WsoD (White Screen of Death) error. Similarly, the same method helps users avoid the 405 Method Not Allowed error.
Other Errors and Error Codes Users Must Know
Apart from the WordPress max_execution_time fatal error, users should learn other errors and error codes, such as:
- DNS_PROBE_FINISHED_NXDOMAIN error
- ERR_CONNECTION_RESET
- Error Establishing a Database Connection
- Missed Schedule Post Error
- ERR_CONNECTION_TIMED_OUT
- ERR_CONNECTION_REFUSED
- ERR_CACHE_MISS
- XAMPP Localhost/index.php
- White Screen of Death (WSoD)
- Chrome Net Internals DNS
Do You Need Professional Help?
WPExperts is a seasoned WordPress development and marketing firm providing users with WordPress theme development and customization services worldwide. This way, they can eliminate the maximum execution time exceeded error.
Wrapping Up
We expect you to appreciate our blog post, which helps you fix the fatal WordPress max_execution_time error. This error occurs because of slow PHP scripts. This issue appears within WordPress themes, plugins, etc. Moreover, you can experience the maximum execution time exceeded error when updating the previous WordPress versions to the new or latest version.
Likewise, you can receive an email from WordPress indicating the max_execution_time error and witness the same error inside the WordPress dashboard. Additionally, do not get confused if you see a ‘technical difficulties’ message on your screen.
You can benefit from various troubleshooting when resolving the maximum execution time exceeded error. However, you must follow the above methods properly. Doing so lets you overcome this error and restore your WordPress website within minutes.