Skip to main content

How to Fix a WordPress Maximum Execution Time Exceeded Error

The "Maximum Execution Time Exceeded" error occurs when a WordPress script takes longer to run than the limit allowed by the server's PHP configuration. This article helps a Site Administrator identify and resolve this issue to ensure scripts, such as...

The "Maximum Execution Time Exceeded" error occurs when a WordPress script takes longer to run than the limit allowed by the server's PHP configuration. This article helps a Site Administrator identify and resolve this issue to ensure scripts, such as plugin updates or large imports, complete successfully.

Before you begin

You will need:

  • Administrator access to your WordPress dashboard.

  • Access to your hosting control panel (such as cPanel or Windows Control Panel) or a file manager.

  • Knowledge of the specific page or action that triggers the error.

Increase the PHP Max Execution Time

Depending on your hosting environment and the specific requirements of your site, you can increase the execution limit using one of the following methods.

Method 1: Edit the .htaccess file

This method is common for many Apache-based hosting environments.

  1. Access your site's root directory via a File Manager or FTP client.

  2. Locate the .htaccess file in the root directory.

  3. Open the file and add the following line at the end:

    php_value max_execution_time 300

  4. Save the changes.

Method 2: Edit the wp-config.php file

You can attempt to define the limit directly within the WordPress configuration.

  1. Access your site's root directory via a File Manager or FTP client.

  2. Locate the wp-config.php file.

  3. Open the file and add the following line before the "That's all, stop editing!" line:

    @ini_set('max_execution_time', 300);

  4. Save the changes.

Method 3: Edit the php.ini or .user.ini file

If your host allows local overrides, you can create or edit a PHP configuration file.

  1. Access your site's root directory via a File Manager or FTP client.

  2. Look for a file named php.ini or .user.ini. If it does not exist, create a new file with the appropriate name.

  3. Open the file and locate the max_execution_time line.

  4. Change the value to a higher number (e.g., 300):

    max_execution_time = 300

  5. Save the changes.

Confirm the result

To verify the fix, perform the action that previously triggered the error (such as running a large plugin update or a data import).

  • The process completes without displaying the "Maximum Execution Time Exceeded" message.

  • The page loads successfully without a "500 Internal Server Error" or a timeout message.

If the error persists

If the error remains after increasing the limit in the files above, the limit may be enforced at the server level by your hosting provider.

  1. Log in to your hosting control panel.

  2. Locate the Select PHP Version or PHP Editor tool.

  3. Find the max_execution_time setting in the list of PHP options.

  4. Increase the value and click Save or Apply.

  5. If you cannot find this setting in your control panel, contact Hostek support to request a manual increase of the max_execution_time for your account.

Limitations

  • Increasing the max_execution_time to an excessively high number (e.g., over 300 seconds) can impact server performance and may be restricted by your hosting plan.

  • Changes made via .htaccess or php.ini may not take effect immediately if the web server requires a restart, though this is rare on shared hosting environments.

  • This procedure does not resolve issues caused by poorly optimized plugins or themes; if a specific plugin consistently hits the limit even after an increase, that plugin may need to be replaced or updated.

Did this answer your question?