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

wpcanyon.com

Tag: PHP.ini

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

Increase upload_max_filesize (Uploaded file exceeds the upload_max_filesize directive)

Posted on August 19, 2025 By Admin No Comments on Increase upload_max_filesize (Uploaded file exceeds the upload_max_filesize directive)

Increase upload_max_filesize (Uploaded file exceeds the upload_max_filesize directive)

If you encounter the error “Uploaded file exceeds the upload_max_filesize directive” in WordPress, it means your server’s PHP configuration limits the maximum file size you can upload. This often blocks you from uploading large media files or plugins. The quick fix is to increase the upload_max_filesize value in your PHP settings.

Quick Fix

  1. Edit your php.ini file (or create one if it doesn’t exist) and add or update this line:
    upload_max_filesize = 64M
  2. Also increase post_max_size to the same or larger value:
    post_max_size = 64M
  3. Restart your web server (Apache, Nginx, LiteSpeed) to apply changes.
  4. Verify the new limits in WordPress by going to Media > Add New or using a PHP info plugin.

Why this happens

PHP has built-in limits on file upload sizes to prevent server overload and abuse. The upload_max_filesize directive controls the maximum size of an uploaded file, while post_max_size controls the maximum size of POST data allowed. If your file exceeds these limits, PHP rejects the upload and WordPress shows the error.

By default, many hosting providers set these values low (e.g., 2MB or 8MB) to conserve resources. To upload larger files, you must increase these limits manually.

Step-by-step

1. For Apache or LiteSpeed servers

  1. Locate your php.ini file. Common locations:
    • /etc/php/7.x/apache2/php.ini
    • /usr/local/lib/php.ini
    • Use phpinfo() to find the loaded config file.
  2. Edit the php.ini file and update or add:
    upload_max_filesize = 64M
    post_max_size = 64M
    memory_limit = 128M
    max_execution_time = 300
    max_input_time = 300
  3. Save the file and restart Apache or LiteSpeed:
    sudo systemctl restart apache2
    # or for LiteSpeed
    sudo systemctl restart lsws
  4. Check changes with a PHP info file or WordPress media uploader.

2. For Nginx servers

  1. Edit your PHP-FPM php.ini file (location similar to Apache).
  2. Update the same directives as above:
    upload_max_filesize = 64M
    post_max_size = 64M
    memory_limit = 128M
    max_execution_time = 300
    max_input_time = 300
  3. Edit your Nginx site configuration file (e.g., /etc/nginx/sites-available/example.com) and add or update:
    client_max_body_size 64M;
  4. Restart PHP-FPM and Nginx:
    sudo systemctl restart php7.x-fpm
    sudo systemctl restart nginx
  5. Verify upload limits in WordPress.

3. Using cPanel

  1. Log in to your cPanel dashboard.
  2. Go to MultiPHP INI Editor under the Software section.
  3. Select your domain from the dropdown.
  4. Set upload_max_filesize and post_max_size to your desired values (e.g., 64M).
  5. Save the changes.
  6. Check your WordPress upload limits.

4. Using Plesk

  1. Log in to Plesk.
  2. Go to Domains > example.com > PHP Settings.
  3. Find upload_max_filesize and post_max_size and increase their values.
  4. Save the settings.
  5. Test upload limits in WordPress.

Works on

Server Control Panel Notes
Apache cPanel, Plesk, Manual Requires php.ini edit and server restart
Nginx cPanel, Plesk, Manual Requires php.ini and nginx.conf edits + restarts
LiteSpeed cPanel, Manual Similar to Apache, restart LiteSpeed after changes

FAQ

  1. Q: I increased upload_max_filesize but still get the error. Why?

    A: You must also increase post_max_size and ensure your web server (Nginx or Apache) allows larger uploads (e.g., client_max_body_size in Nginx). Restart your server after changes.

  2. Q: Can I increase upload limits via .htaccess?

    A: Only on Apache servers with PHP running as an Apache module. Add these lines to your .htaccess:

    php_value upload_max_filesize 64M
    php_value post_max_size 64M
  3. Q: How do I check current upload limits?

    A: Use a PHP info plugin in WordPress or create a phpinfo.php file with:

    <?php phpinfo(); ?>

    Then open it in your browser and look for upload_max_filesize

…
Fixes & Errors

Increase WordPress PHP memory limit (Allowed memory size exhausted)

Posted on August 19, 2025 By Admin No Comments on Increase WordPress PHP memory limit (Allowed memory size exhausted)

Increase WordPress PHP Memory Limit (Allowed memory size exhausted)

If you encounter the “Allowed memory size exhausted” error in WordPress, it means your site has reached the maximum PHP memory allocated by your server. This limits WordPress from executing scripts properly, causing errors or white screens. The quick fix is to increase the PHP memory limit to allow WordPress more resources to run smoothly.

Quick Fix

  1. Edit your wp-config.php file located in your WordPress root directory.
  2. Add or update the following line just before the /* That's all, stop editing! Happy blogging. */ comment:
define('WP_MEMORY_LIMIT', '256M');

This increases the PHP memory limit to 256 megabytes, which is sufficient for most sites.

Why This Happens

WordPress runs on PHP, which has a memory limit set by your server’s PHP configuration. When a script exceeds this limit, PHP throws the “Allowed memory size exhausted” fatal error. Common causes include:

  • Heavy plugins or themes consuming excessive memory.
  • Large imports, backups, or media processing tasks.
  • Default PHP memory limit set too low (often 32M or 64M).
  • Shared hosting environments with strict memory caps.

Increasing the memory limit gives WordPress more room to operate, preventing these errors.

Step-by-step: Increase PHP Memory Limit

1. Using wp-config.php (Recommended)

  1. Access your WordPress root directory via FTP, SFTP, or your hosting file manager.
  2. Open the wp-config.php file for editing.
  3. Locate the line that says /* That's all, stop editing! Happy blogging. */.
  4. Add this line right above it:
define('WP_MEMORY_LIMIT', '256M');

Save and upload the file back to the server.

2. Editing php.ini (If you have server access)

  1. Locate your php.ini file (usually in /etc/php/ or your hosting control panel).
  2. Open php.ini for editing.
  3. Find the line starting with memory_limit.
  4. Change it to:
memory_limit = 256M
  1. Save the file and restart your web server (Apache/Nginx) to apply changes.

3. Using .htaccess (Apache only)

  1. Open the .htaccess file in your WordPress root directory.
  2. Add this line at the top:
php_value memory_limit 256M

Note: This method only works if your hosting allows overriding PHP settings via .htaccess.

4. cPanel/Plesk PHP Memory Limit Adjustment

  1. Log in to your hosting control panel (cPanel or Plesk).
  2. Navigate to PHP Settings or PHP Selector.
  3. Find the memory_limit setting and increase it to 256M or higher.
  4. Save changes and restart PHP if required.

Works on

Environment Compatibility
Apache Web Server Yes (via wp-config.php, php.ini, .htaccess)
Nginx Web Server Yes (via wp-config.php, php.ini)
LiteSpeed Web Server Yes (via wp-config.php, php.ini)
cPanel Hosting Yes (via PHP Selector or php.ini)
Plesk Hosting Yes (via PHP Settings or php.ini)

FAQ

Q1: How much memory should I set for WordPress PHP memory limit?
A: 256M is a good starting point for most sites. For very large or resource-heavy sites, you may increase it to 512M or more, but check with your hosting provider first.
Q2: What if increasing memory limit doesn’t fix the error?
A: The error might be caused by poorly coded plugins or themes consuming excessive memory. Try disabling plugins one by one or switching to a default theme to identify the culprit.
Q3: Can I increase memory limit via WordPress dashboard?
A: No, WordPress dashboard does not provide an option to increase PHP memory. You must edit server or WordPress configuration files.
Q4: Is there a risk in increasing PHP memory limit?
A: Increasing memory limit allows scripts to use more server resources, which can impact server performance if set too high. Always increase cautiously and monitor your site’s behavior.
Q5: My hosting provider doesn’t allow increasing memory limit. What can I do?
A: Contact your hosting support to request a higher memory limit or consider upgrading to a hosting plan with more resources.
…
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