Skip to content
  • Quick Ref
  • Contact
  • About
wpcanyon.com

wpcanyon.com

Tag: Timeout

Fix “Maximum execution time of 30 seconds exceeded” in WordPress

Posted on August 19, 2025 By Admin No Comments on Fix “Maximum execution time of 30 seconds exceeded” in WordPress

Fix “Maximum execution time of 30 seconds exceeded” in WordPress

If you encounter the error “Maximum execution time of 30 seconds exceeded” in WordPress, it means a PHP script is taking too long to run and is being stopped by the server. This often happens during plugin updates, backups, or importing large files. The quick fix is to increase the PHP maximum execution time limit so scripts have more time to complete.

Quick Fix

  1. Access your WordPress root directory via FTP or file manager.
  2. Edit or create a php.ini or .user.ini file.
  3. Add or update this line to increase the time limit (e.g., 300 seconds):
max_execution_time = 300
  1. If you cannot edit php.ini, add this line to your wp-config.php file instead:
set_time_limit(300);
  1. Save changes and test your site or process again.

Why This Happens

PHP scripts have a maximum execution time to prevent poorly written code from running indefinitely and overloading the server. The default is often set to 30 seconds on many shared hosting environments. When WordPress or a plugin runs a process that takes longer—like importing large data, running backups, or complex queries—the script hits this limit and stops, causing the error.

Increasing the max_execution_time gives scripts more time to finish. However, setting it too high may affect server performance, so adjust carefully based on your needs.

Step-by-step Guide to Fix the Error

1. Using php.ini or .user.ini (Recommended)

This method works if you have access to your PHP configuration files.

  1. Connect to your server using FTP or your hosting control panel file manager.
  2. Navigate to your WordPress root directory (where wp-config.php is located).
  3. Look for a php.ini or .user.ini file. If none exists, create a new file named php.ini or .user.ini.
  4. Edit the file and add or update the following line:
max_execution_time = 300

This sets the maximum execution time to 300 seconds (5 minutes).

  1. Save the file and upload it back to the server if using FTP.
  2. Restart your web server if you have control over it (not always possible on shared hosting).
  3. Test your WordPress site or the process that caused the error.

2. Using wp-config.php

If you cannot access or modify php.ini, you can try increasing the time limit via WordPress configuration.

  1. Access your WordPress root directory.
  2. Edit the wp-config.php file.
  3. Add the following line near the top, just after the opening <?php tag:
set_time_limit(300);
  1. Save the file and upload it back.
  2. Test your site or process again.

3. For Nginx Servers

Nginx does not use php.ini directly but you can increase PHP-FPM timeout settings.

  1. Access your server via SSH.
  2. Edit your PHP-FPM pool configuration file, usually located at:
/etc/php/7.x/fpm/pool.d/www.conf

(Replace 7.x with your PHP version.)

  1. Find and update these values:
request_terminate_timeout = 300s
max_execution_time = 300
  1. Save the file.
  2. Restart PHP-FPM and Nginx:
sudo systemctl restart php7.x-fpm
sudo systemctl restart nginx

Replace php7.x-fpm with your PHP-FPM service name.

4. For Apache Servers

Apache usually respects php.ini or .htaccess overrides.

  1. Access your WordPress root directory.
  2. Edit or create a .htaccess file.
  3. Add this line:
php_value max_execution_time 300
  1. Save and upload the file.
  2. Restart Apache if you have server access:
sudo systemctl restart apache2

On shared hosting, this restart is handled automatically.

5. Using cPanel

  1. Log in to your cPanel dashboard.
  2. Go to Select PHP Version or MultiPHP INI Editor.
  3. Find the max_execution_time setting.
  4. Increase the value to 300 or higher.
  5. Save changes.

6. Using Plesk

  1. Log in to your Plesk panel.
  2. Go to Domains > select your domain > PHP Settings.
  3. Find max_execution_time and increase it.
  4. Save changes.

Works on

Environment Applicable Fix
Apache (shared/dedicated) .htaccess, php.ini, wp-config.php
Nginx with PHP-FPM php.ini, PHP-FPM config, wp-config.php
cPanel Hosting
…
Fixes & Errors

Recent Posts

  • Top WordPress Themes for Blogs in 2025
  • WordPress Admin Panel Trick: Adding ID Field to the Posts Listing
  • Solution previous_posts_link and next_posts_link Not Working
  • Show Top Commentators in WordPress Without a Plugin
  • How to Style Admin Comments in WordPress

Recent Comments

    Archives

    • August 2025

    Categories

    • Admin & Blocks
    • Admin & UI
    • Automation
    • Automation & Plugins
    • Comments
    • Comparisons
    • Database & Revisions
    • Developer Snippets
    • Fixes & Errors
    • Media & Thumbnails
    • Queries & Pagination
    • Security
    • Speed & Security
    • Tips & Tricks
    • WooCommerce How‑tos
    • WordPress Snippets
    • WordPress Themes
    • Terms & Conditions
    • Affiliate Disclosure

    Copyright © 2025 wpcanyon.com.

    Powered by PressBook WordPress theme

    Also by the maker of MySurveyReviews.com