Diagnostic tool

WordPress Memory Limit Exhausted Fix Tool

By Arjun Mehta Browser only, no data sent

The fatal PHP error 'Allowed memory size of X bytes exhausted' is one of the most misdiagnosed WordPress problems. Increasing WP_MEMORY_LIMIT in wp-config.php often does nothing because the real cap lives in php.ini, .user.ini, the FastCGI pool, or your host's control panel. This advanced tool asks four targeted questions and returns the exact override path for your host plus a memory-leak detection routine, not generic copy-paste advice.

Stop 'Allowed memory size exhausted' fatal errors with host-specific overrides and real leak detection.

No login required Free forever

Step 1: Describe the issue

Frequently asked questions

Why does raising WP_MEMORY_LIMIT in wp-config.php do nothing on my host?

Because the real ceiling is enforced by PHP-FPM or the hosting control panel, not by WordPress. SiteGround, Kinsta, WP Engine, and Hostinger all override the WordPress constant. You must raise memory_limit in the host's PHP settings UI, php.ini, or the FPM pool, not in wp-config.

What is a safe memory_limit value for WordPress?

256M is the minimum for a modern site, 512M is the safe default for WooCommerce, page builders, and membership plugins, and 768M handles heavy admin sessions with the block editor. Going above 1024M on shared hosting risks throttling or suspension.

How do I confirm the new memory_limit actually applied?

Drop a temporary file named phpinfo.php with <?php phpinfo(); in your site root, visit it, and read the memory_limit row. Delete the file immediately after, it exposes server details. Do not rely on the Site Health screen, it reports WP_MEMORY_LIMIT, not the PHP-FPM enforced value.

Is the memory error always a plugin problem?

No. Roughly 60 percent of cases are a host cap that the wp-config edit cannot override. The other 40 percent are a leaking plugin, usually related-posts, analytics, SEO, or a misbehaving page builder add-on. The MU memory logger in the tool tells you which category you are in within 30 minutes of real traffic.

Why does the error happen only when I upload images?

Image decoding allocates roughly 5x the pixel count in RAM. A single 4000x3000 photo needs about 240MB before any plugin overhead. Either raise memory_limit to 512M or set a big_image_size_threshold filter so WordPress downscales uploads on intake.

Why does the error happen only in wp-admin?

wp-admin loads every plugin's admin hooks plus the block editor's REST stack. Admin requests typically need 2 to 3 times the memory of front-end requests. Set WP_MAX_MEMORY_LIMIT to 768M and drop a .user.ini with memory_limit = 768M inside /wp-admin.

Can I detect which plugin is leaking memory?

Yes. Install Query Monitor and sort the requests panel by Peak Memory, or drop the MU logger snippet from the tool into /wp-content/mu-plugins/memory-log.php. Reproduce normal traffic for 15 to 30 minutes, then read /wp-content/debug.log for the top URLs by peak memory.

What does WP_MAX_MEMORY_LIMIT do that WP_MEMORY_LIMIT does not?

WP_MEMORY_LIMIT applies to front-end and most code paths. WP_MAX_MEMORY_LIMIT applies specifically to admin and image-processing tasks and overrides the lower constant in those contexts. Set both, with the max value equal to or higher than the base.

In-depth guide

Everything you need to know about the WordPress Memory Limit Exhausted Fix Tool

Overview

The WordPress Memory Limit Exhausted Fix Tool is an advanced, host-aware diagnostic designed for the single most misdiagnosed fatal PHP error on WordPress: 'Allowed memory size of X bytes exhausted'. Almost every generic guide tells you to add define('WP_MEMORY_LIMIT', '256M'); to wp-config.php and call it done. On modern managed and shared hosts this constant is silently ignored because the real ceiling lives in the host's PHP-FPM pool, hPanel, Site Tools, or a plan-level enforcement layer.

This tool asks four targeted questions, where the site is hosted, when the error happens, whether you have already tried the wp-config edit, and your access level, then returns the exact override path for SiteGround, Bluehost, Hostinger, Kinsta, WP Engine, Cloudways, generic cPanel, and Local. It also bundles a copy-paste MU plugin that logs peak memory per URL, so you can prove which plugin is leaking instead of guessing.

Why this matters for WordPress site owners

The 'Allowed memory size exhausted' error is the highest-volume WordPress fatal error after the white screen of death, and the one with the lowest first-fix success rate. Site owners burn hours editing wp-config.php on hosts that override it, or pay for a hosting upgrade they did not need because they never identified the real leak. WooCommerce stores lose checkout completions every minute the error fires, and Google Search Console flags the URLs as 5xx within a single crawl cycle, which can suppress rankings for days even after the fix.

How to use this tool, step by step

  1. 1Pick your host from the list, the override path is fundamentally different on each one.
  2. 2Choose when the error appears, on every page, only in wp-admin, during uploads, during cron jobs, or randomly.
  3. 3Tell the tool whether you have already raised WP_MEMORY_LIMIT and what happened.
  4. 4Select your access level, the tool prefers SSH/CLI paths when available because they bypass FastCGI caches.
  5. 5Run the host-specific override, then verify with a temporary phpinfo() probe, never trust the WordPress Site Health screen alone, it reads WP_MEMORY_LIMIT, not the real PHP cap.

Expertise and methodology

The override paths are maintained against the current Site Tools (SiteGround), hPanel (Hostinger), MyKinsta, WP Engine User Portal, Cloudways Platform, and standard cPanel + MultiPHP INI Editor flows. The leak-detection MU plugin uses memory_get_peak_usage(true), which reports real allocated memory rather than reported usage, and is the same instrumentation Query Monitor exposes in its Peak Memory column. Every host-specific note reflects how the underlying PHP handler (suPHP, PHP-FPM, LiteSpeed LSAPI) reads or ignores user-supplied ini files, which is the root reason wp-config edits fail in the first place.

Reviewed and maintained by Arjun Mehta, WordPress recovery engineer, 12+ years rescuing broken sites at WPRescue.

Common mistakes to avoid

  • Editing wp-config.php and stopping there. On SiteGround, Kinsta, WP Engine, and Hostinger the host cap wins, the WordPress constant is purely advisory.
  • Setting memory_limit to 2G or higher on shared hosting. The host will throttle or suspend the account before WordPress ever crashes, and you will be told the site was abusive rather than leaking.
  • Increasing the limit instead of finding the leak. A plugin that allocates 400MB per request is broken, raising the ceiling to 1GB only delays the next crash.
  • Leaving the MU memory logger in place on production. It writes to error_log on every request and will fill the log volume within days.
  • Trusting the WordPress Site Health 'PHP memory limit' check, it reflects what WordPress thinks, not what PHP-FPM enforces.

Need hands-on help?

If this tool does not cover your exact situation, contact WPRescue or read the troubleshooting guides. We typically reply within one business day.