Skip to content

Tutorials WordPress Beginner1 min read

How to Fix 'Allowed Memory Size Exhausted' in WordPress

Fix the PHP fatal error 'Allowed memory size of X bytes exhausted' in WordPress by raising WP_MEMORY_LIMIT and memory_limit, and finding the plugin that needs it.

By ZSOLNET Editorial Team Updated

Key takeaways

  • A script tried to use more memory than PHP allows.
  • Raise WP_MEMORY_LIMIT and PHP's memory_limit together.
  • If the error returns, find the plugin or theme that leaks memory.

The full message looks like this: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes). The number is PHP’s limit in bytes — here, 128 MB.

Raise the limit

  1. Connect with cPanel’s File Manager or SFTP and open wp-config.php.
  2. Above the line that says /* That's all, stop editing! */, add:
define( 'WP_MEMORY_LIMIT', '256M' );
define( 'WP_MAX_MEMORY_LIMIT', '512M' ); // used in the admin area
  1. In cPanel, open MultiPHP INI Editor, select the domain and set memory_limit to 256M or higher.
  2. Reload the page that failed.

Find the cause

Raising the limit fixes the symptom. If a normal page needs more than 256 MB, something is inefficient.

  1. Note where it happens — a specific admin page, an import, or every page?
  2. Deactivate plugins one by one (or rename wp-content/plugins temporarily via File Manager) and retest.
  3. Switch to a default theme to rule out the theme.
  4. Turn on debug logging to see the file that triggered the error.

Frequently asked questions

How much memory does WordPress need?

A typical site runs comfortably at 128–256 MB. Page builders, WooCommerce and large imports may need 256–512 MB.

I set WP_MEMORY_LIMIT but nothing changed.

WordPress can't raise memory above PHP's own memory_limit. Raise memory_limit in cPanel's MultiPHP INI Editor too.

Share X LinkedIn Facebook

Log in to your account

Manage your domains, hosting and invoices in one place.

Secure connection straight to the ZSOLNET client area.

Open the ZSOLNET dashboard

No account yet?