Tutorials

WordPress 'Allowed Memory Size Exhausted': The WP_MEMORY_LIMIT vs PHP Limit Trap (2026)

By Daniel Reyes•October 2, 2026•3 min read

Disclosure: some links on this page are affiliate links. We may earn a commission at no extra cost to you. How we test and rate hosts.

Our top pick for most WordPress sites
Bluehost: free domain, free SSL, 24/7 support, 30-day money-back guarantee.
Check Bluehost Deal →

The error: "Fatal error: Allowed memory size of X bytes exhausted" — a script (almost always a plugin/theme) hit the memory ceiling. The trap most guides miss: there are TWO limits — WP_MEMORY_LIMIT (what WordPress requests) and the server's memory_limit (the hard cap). Setting WP_MEMORY_LIMIT higher than the server cap does nothing. Here's the fix that accounts for both.

Step 1: Check the Real Limit First (Don't Edit Blind)

Tools → Site Health → Info → Server shows PHP memory limit — that's the ceiling. Elementor users: Elementor → System Info shows both limits. WooCommerce: WooCommerce → Status → System Status. Knowing the real cap determines whether your fix works at all.

The Two-Limit Distinction (What Most Guides Get Wrong)

  • memory_limit (server, php.ini) — the hard cap PHP enforces. Your host controls this; you can't exceed it from WordPress.
  • WP_MEMORY_LIMIT (wp-config.php) — what WordPress requests. Default ~40M (64M multisite). Cannot exceed memory_limit.

So the logic is: if Site Health shows memory_limit = 128M and you set WP_MEMORY_LIMIT = 256M, WordPress still gets 128M. The wp-config.php edit alone only works when the server cap is already higher.

Step 2: Raise WP_MEMORY_LIMIT in wp-config.php

In wp-config.php, above /* That's all, stop editing */:

define( 'WP_MEMORY_LIMIT', '256M' );

256M is healthy for most sites; heavy WooCommerce/Elementor setups may need 512M. If Site Health showed memory_limit ≥ 256M already, this alone fixes it.

Step 3: Raise the Server Cap (When wp-config.php Isn't Enough)

If Site Health showed a lower cap, raise it at the server level — whichever your host allows:

  • php.ini — memory_limit = 256M (if your host exposes php.ini edits)
  • .htaccess — php_value memory_limit 256M (works on Apache when allowed)
  • Hosting panel — many hosts (SiteGround Site Tools, cPanel MultiPHP INI Editor) have a PHP settings UI
  • Ask support — on managed hosts, a ticket is often fastest

Step 4: Find the Memory-Hungry Plugin

If the error persists even at high limits, a plugin/theme is leaking memory — not hitting a cap, consuming everything. Disable plugins one at a time, reload, watch for the error. Query Monitor plugin shows per-plugin memory usage. A plugin that needs 512M+ is usually broken, not demanding — replace it.

When It's a Hosting Problem, Not a Config Problem

If every limit is raised correctly and the error still appears under normal traffic, the server's actual RAM allocation is the ceiling — not a setting you can edit. Oversold shared hosting enforces tight memory caps because hundreds of sites share the box. At that point the fix is a host with real headroom: Bluehost's WP Cloud tiers run WordPress on isolated infrastructure where memory_limit is generous by default, not throttled by neighbors.

Memory Limits That Aren't a Ceiling

Bluehost managed WordPress on WP Cloud — isolated containers with sane PHP limits by default. Stop fighting memory caps on oversold shared hosting.

Get Bluehost Managed WP →

Related: critical error fix, white screen of death, 500 internal server error.

Find Your Perfect Hosting Plan

What are you building?

Tell us about your project so we can match the perfect hosting plan.

Question 1 of 425% complete
Interactive Tool

Hosting Cost Calculator

See exactly how much you'll spend on hosting over time. Compare Bluehost vs popular alternatives and discover your potential savings.

Used to calculate transaction fees (Shopify charges 2% on sales)

Shopify Basic (3yr)
$1,044
Bluehost (3yr)
$444
You Save
$600
58% less than Shopify Basic

Frequently Asked Questions

How do I fix 'Allowed memory size exhausted'?

Add define( 'WP_MEMORY_LIMIT', '256M' ); to wp-config.php — but that only works if the server's PHP memory_limit allows it. Check Site Health > Info > Server to see the real limit; if it's lower than 256M, edit php.ini/.htaccess or ask your host — WP_MEMORY_LIMIT can't override the server cap.

What's the difference between WP_MEMORY_LIMIT and memory_limit?

WP_MEMORY_LIMIT is WordPress's request — 'I want this much.' memory_limit in php.ini is the server's hard cap — 'you can have at most this.' WP_MEMORY_LIMIT cannot exceed memory_limit; setting WP_MEMORY_LIMIT to 512M on a 128M server does nothing. Most guides miss this.

Where do I check my current memory limit?

Tools > Site Health > Info > Server shows 'PHP memory limit' — that's the real ceiling. Elementor users: Elementor > System Info shows both. WooCommerce: WooCommerce > Status > System Status.

Why does increasing memory in wp-config.php not work?

Because the server's memory_limit is lower than what you set — the hard cap wins. Either edit php.ini/.htaccess (if your host allows it) or ask the host to raise the server limit.

Is 'Allowed memory size' dangerous?

No — it's a resource cap hit, not data loss. A script (usually a plugin/theme) needed more memory than PHP was allowed to use. Fix the limit or find the memory-hungry plugin.

When is it a hosting problem, not a config problem?

When you've raised every limit correctly and still hit the cap under normal load — cheap shared hosting's tight memory limits are the cause. At that point the fix is a host with real headroom, not more config edits.

Ready to launch?

Get Bluehost from $3.99/month with a free domain, free SSL, and 30-day money-back guarantee.

Start for $3.99 →

Related Articles