1. PrettyWP
  2. PrettyWP Guides
  3. Tutorials
  4. Fixing the 'Maximum Execution Time Exceeded' Error

Fixing the 'Maximum Execution Time Exceeded' Error


The "Maximum Execution Time Exceeded" error is a common issue encountered by WordPress users when executing time-consuming tasks such as plugin or theme installations, updates, or bulk operations. This error occurs when the PHP script exceeds the maximum time limit set by the server.

Understanding the Error

The "Maximum Execution Time Exceeded" error typically manifests as a message similar to "Fatal error: Maximum execution time of XX seconds exceeded." It indicates that the PHP script took longer to execute than the server's configured time limit. By default, most servers set the maximum execution time to 30 seconds, but this can vary depending on your hosting environment.

Methods to Fix the Error:

Method 1: Editing the .htaccess File:

  1. Access your WordPress root directory using an FTP client or a file manager provided by your hosting provider.
  2. Locate the .htaccess file and download a backup copy as a precaution.
  3. Open the .htaccess file in a text editor and add the following line:

    php_value max_execution_time 90
    This sets the maximum execution time to 90 seconds. Adjust the value as needed.

  4. Save the changes to the .htaccess file and upload it back to your server, replacing the existing file

Method 2: Editing the wp-config.php File:

  1. Access your WordPress root directory and locate the wp-config.php file.
  2. Download a backup copy of the file.
  3. Open the wp-config.php file in a text editor and add the following line before the "/* That's all, stop editing! */" comment:

    set_time_limit(90);
    This sets the maximum execution time to 90 seconds. Adjust the value as needed.

  4. Save the changes to the wp-config.php file and upload it back to your server, replacing the existing file.

Method 3: Editing the php.ini File:

  1. Access your server's php.ini file. If you are unsure of its location, consult your hosting provider's documentation or support.
  2. Download a backup copy of the php.ini file.
  3. Open the php.ini file in a text editor and locate the "max_execution_time" directive.
  4. Change the value to the desired maximum execution time, for example:

    max_execution_time = 90
    Save the changes to the php.ini file.

  5. If you don't have access to the php.ini file, you can try creating a new file called .user.ini in your WordPress root directory and add the following line to it:

    max_execution_time = 90


Method 4: Using a Plugin

If you prefer a more user-friendly approach, you can use a plugin to modify the maximum execution time. Plugins like "WP Maximum Execution Time Exceeded" or "WP Tools Increase Maximum Limits, Repair, Server PHP Info, Javascript errors, File Permissions, Transients, Error Log" allow you to change the value directly from your WordPress admin dashboard. Install and activate the plugin, navigate to its settings, and adjust the maximum execution time to your desired value.

Whether you choose to edit the .htaccess file, wp-config.php file, php.ini file, or use a plugin, adjusting the maximum execution time allows PHP scripts to run for a longer duration. However, it's important to note that setting a very high value may impact server performance. Consider the nature of the task at hand and the capabilities of your hosting environment when adjusting the maximum execution time.

Previous Guide to Optimizing Your WordPress Website for Peak Performance
Next Beginner's Guide: Setting Up Automated Backups with UpdraftPlus