Severity: Major · Fix time: 5–15 min · Skill level: Beginner
Memory Exhausted Error is a PHP fatal error that occurs when a WordPress site attempts to use more memory than its server configuration allows. The error message typically reads: “Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate X bytes).” When PHP hits this limit, it stops execution entirely — the affected page shows nothing, a blank white screen, or the raw error message, depending on debug settings.
PHP allocates a defined amount of memory to each running process. When a WordPress page load — or a specific action like installing a plugin, importing content, or running a background task — requires more memory than the configured limit allows, PHP throws this error rather than continuing. It’s one of the more common WordPress errors, particularly on sites running many plugins, handling large data sets, or hosted on plans with low default PHP memory limits. Most instances are fixable in under 15 minutes once the cause is identified.
Need a quick map of every WordPress error? See our 70+ WordPress Errors Guide → for a categorized reference of every common WordPress issue.
[Image: Diagram showing the PHP memory limit hierarchy: server php.ini → wp-config.php WP_MEMORY_LIMIT → WordPress application, with arrows showing which setting takes precedence]
How the PHP Memory Limit Works in WordPress
Several configuration layers control how much PHP memory is available to WordPress, and they interact in a specific order:
- Server-level PHP configuration (
php.ini) — The hosting server sets the master memory limit. This is the absolute ceiling. Shared hosting typically sets this at 128MB or 256MB; managed and dedicated hosting often provides more. - WordPress application request (
wp-config.php) — WordPress can request a specific memory limit by definingWP_MEMORY_LIMITinwp-config.php. This is a request to the server, not an override — if the server’s hard limit is lower, the request is silently ignored. - WordPress admin limit — WordPress also defines
WP_MAX_MEMORY_LIMITfor admin-side tasks, which often require more memory than front-end page loads — particularly on the Posts, WooCommerce Orders, or Plugins admin pages. - WordPress default — Without explicit configuration, WordPress requests at least 40MB of PHP memory and will attempt to use 256MB if available.
Common scenarios that trigger the memory exhausted error:
- Plugin installation or activation — A large plugin loads significant code and data during activation, pushing the PHP process past the memory limit.
- Admin pages on high-volume sites — Pages like Posts, WooCommerce Orders, or the Plugins list load many database records simultaneously, consuming more memory than front-end pages.
- WooCommerce image processing — Bulk importing product images and generating multiple thumbnail sizes for each can exhaust available memory.
- Backup plugin operations — Full-site backup plugins that compress files in memory during export can spike memory usage significantly.
- Plugins with memory leaks — Poorly coded plugins that load entire datasets into memory when only a subset is needed can trigger memory exhaustion on routine page loads.
Check This First — 2-Minute Diagnostic
- Identify when the error appears — Does it happen during a specific admin action (plugin installation, import, backup) or on regular front-end page loads? Action-triggered errors are far easier to fix than persistent ones.
- Read the full error message — The error includes the byte count of the limit and how much more memory was requested. This tells you how far over the limit you are and whether a small increase will resolve it or whether something is consuming memory unexpectedly.
- Check your current PHP memory limit — In wp-admin, go to Tools → Site Health → Info → Server and look for “PHP memory limit.” This shows the actual limit currently in effect, which confirms whether
wp-config.phpchanges are taking effect. - Enable WP_DEBUG logging — Add
define('WP_DEBUG', true);anddefine('WP_DEBUG_LOG', true);towp-config.phpto capture error details in/wp-content/debug.logwithout displaying them publicly. - Check active plugin count and size — A site running 40+ plugins is at higher memory risk than one running 10-15. Consider whether inactive plugins can be removed entirely rather than just deactivated.
Purpose & Benefits
1. Faster, More Accurate Troubleshooting
The memory exhausted error is precise in what it tells you: PHP ran out of memory executing something specific. The byte counts in the error message tell you both how much memory PHP was allowed and how much more was needed. This precision helps you determine whether you need a small limit increase (you’re slightly over) or whether something is consuming memory far beyond what’s expected (a plugin has a memory leak). Understanding the error structure gets you to the right fix faster.
2. Distinguishing a Configuration Problem from a Performance Problem
A memory exhausted error sometimes reveals that the memory limit simply needs to be raised to accommodate a legitimate need — a larger plugin, a more complex site, a new feature. But it can also reveal that a plugin has a memory leak, or that a process is doing something inefficient — like loading thousands of database records into memory at once when it only needs a few. Understanding the error helps you determine whether to raise a limit, fix a plugin, or upgrade your hosting plan. Our WordPress maintenance services include this kind of plugin performance audit.
3. Preventing the White Screen of Death
Unhandled PHP fatal errors — including memory exhaustion — are among the most common causes of the White Screen of Death (WSOD). A blank white page with no visible error is often a memory limit error that PHP couldn’t display because it ran out of memory before any output could render. Proactively setting an appropriate memory limit prevents these silent failures. This is why setting WP_MEMORY_LIMIT in wp-config.php is part of every WordPress site configuration, not just a troubleshooting step.
Examples
1. Plugin Installation Triggers the Memory Error
A site owner installs a large plugin — a page builder, an e-commerce extension, or a data import tool. During activation, the plugin loads a significant amount of code and data into memory. The PHP process hits the memory limit mid-activation, throws a fatal error, and the plugin fails to activate properly. Fix: add the memory limit definition to wp-config.php before retrying the activation:
// Add before "That's all, stop editing!" in wp-config.php
// Standard recommendation is 256M — not 512M
define( 'WP_MEMORY_LIMIT', '256M' );After saving and re-running the activation, the plugin installs successfully. Confirm the limit is active by checking Tools → Site Health → Info → Server.
2. WooCommerce Admin Page Triggers Memory Error on High-Volume Store
A WooCommerce store with 5,000 orders begins showing memory errors only on the WooCommerce → Orders page in the admin. The Orders page attempts to load and render a large dataset, and the default admin memory limit isn’t sufficient. WordPress’s WP_MAX_MEMORY_LIMIT constant controls the admin-side limit separately from the front-end limit:
// Set both front-end and admin memory limits in wp-config.php
define( 'WP_MEMORY_LIMIT', '256M' ); // Front-end page loads
define( 'WP_MAX_MEMORY_LIMIT', '256M' ); // WordPress admin tasksAdditionally, implementing pagination on the WooCommerce Orders page (reducing the number of orders displayed per page) reduces peak memory consumption even further.
3. Image Import Exhausts Memory on a Large Product Catalog
A WooCommerce store imports a batch of 500 product images. WordPress attempts to generate multiple thumbnail sizes for each image simultaneously, consuming significant memory per image. The process hits the limit partway through. The fix combines two approaches: increasing the memory limit for the import operation, and processing images in smaller batches rather than all at once. For very large image libraries, using SFTP to upload images directly to the media directory and then running media library sync is more efficient than the WordPress dashboard import tool.
Common Mistakes to Avoid
- Raising memory to 512M without investigating the cause — Increasing
WP_MEMORY_LIMITto silence the error without understanding why is a short-term fix. If a plugin has a memory leak, you’re just masking it. Always check whether the memory usage is reasonable for what the site is actually doing before increasing the limit. - Setting a limit in
wp-config.phpthat the server doesn’t allow — WordPress can only request up to the server’s hard limit. If you adddefine('WP_MEMORY_LIMIT', '512M')but your host caps PHP memory at 256M, the request is silently ignored and the limit remains at 256M. Check Tools → Site Health after making changes to confirm the new limit is actually in effect. - Ignoring memory errors that only appear in admin — Memory errors in the WordPress admin don’t affect front-end visitors, which makes them easy to ignore. But they prevent the site owner from performing updates, managing orders, or editing content — operations that need to happen reliably. Admin memory errors deserve the same attention as front-end errors.
- Assuming more memory always means better performance — PHP memory and site speed are different things. Raising the memory limit doesn’t make a slow site faster. It only prevents crashes when processes legitimately need more memory than the current limit allows. Don’t treat memory limit increases as a performance optimization.
- Not removing debug settings after troubleshooting — Enabling
WP_DEBUGwithWP_DEBUG_DISPLAYset to true on a live site exposes PHP error messages to visitors. Always setWP_DEBUG_DISPLAYto false on production sites, and remove debug configuration when troubleshooting is complete.
Best Practices
1. Set a Sensible Memory Limit in wp-config.php
For most WordPress sites, 256M is the right starting point for WP_MEMORY_LIMIT. This covers the vast majority of plugins and use cases without requesting more than most shared hosting environments allow:
// Standard wp-config.php memory configuration
// Add before "That's all, stop editing!" comment
define( 'WP_MEMORY_LIMIT', '256M' ); // Front-end PHP limit
define( 'WP_MAX_MEMORY_LIMIT', '256M' ); // Admin-side limitAfter adding these lines, verify the limit is active in Tools → Site Health → Info → Server. If the reported limit is still lower, your host’s server-level configuration is capping it — contact your host to confirm what’s actually available.
2. Identify and Address Inefficient Plugins
If a specific plugin repeatedly triggers memory errors, investigate whether the plugin has known memory issues and whether updates address them. Test by temporarily deactivating the suspected plugin to confirm which one is responsible — memory usage should drop visibly after deactivation if that plugin was the cause. Some plugins load entire datasets into memory when only a subset is needed, a sign of inefficient development. Replacing memory-inefficient plugins with better-maintained alternatives is a more durable fix than simply raising the limit to accommodate them.
3. Use WP_DEBUG Logging to Catch Memory Errors Early
Rather than waiting for a White Screen of Death (WSOD) or a visible error page, enable debug mode with logging to a file. This captures PHP errors — including memory exhaustion — in a log you can review periodically:
// Safe production debugging setup in wp-config.php
// Errors are written to /wp-content/debug.log — NOT displayed to visitors
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );Review /wp-content/debug.log periodically. Memory warnings that appear before a full exhaustion error give you time to address the cause before the site goes down.
4. Audit and Trim Your Plugin Count
Each installed plugin — even deactivated ones — adds PHP code that WordPress may load partially. Each active plugin adds to the memory footprint of every page load. A site running 50 plugins has a significantly higher baseline memory consumption than one running 20 plugins with comparable functionality. Audit your plugin list regularly: deactivate plugins that aren’t actively used, delete plugins that have been deactivated for more than 30 days, and look for plugins that combine functionality currently covered by multiple separate plugins.
5. Scale Hosting When Memory Limits Become a Recurring Constraint
If memory exhausted errors persist despite a correctly configured WP_MEMORY_LIMIT and a reasonable plugin load, the hosting plan’s server-level PHP memory limit is likely the ceiling. Higher-tier shared hosting or managed WordPress hosting plans provide higher PHP memory limits as a baseline. For sites where memory consumption is a genuine, ongoing operational issue — not just a misconfiguration — upgrading hosting is the right long-term solution.
Frequently Asked Questions
What causes a Memory Exhausted Error most often?
The most common causes are plugin activation or large admin operations that load more data than the current memory limit allows. Sites running many plugins — particularly older or poorly maintained ones — have a higher baseline memory footprint, making them more susceptible to hitting the limit during any peak operation. Check Tools → Site Health → Info → Server to see your current PHP memory limit, and compare it to the byte count in the error message to understand how far over the limit you are.
How do I fix a Memory Exhausted Error when locked out of wp-admin?
This error rarely locks you out of wp-admin — it typically appears while performing an admin action, not on the front-end login page. If wp-admin itself is affected, connect via SFTP and add define('WP_MEMORY_LIMIT', '256M'); to wp-config.php. If a plugin installation or activation triggered the error and left a plugin in a broken half-activated state, you may also need to manually deactivate the problematic plugin by removing or renaming its folder in /wp-content/plugins/.
Can a Memory Exhausted Error hurt my SEO?
Rarely, unless it occurs on front-end pages visible to visitors and search engine crawlers. Memory errors that only surface during admin operations don’t affect front-end page delivery or SEO. If a plugin triggers memory exhaustion on public-facing page loads — for example, a widget running a complex query on every page — visitors will see a blank page or raw error, which does harm user experience and search rankings. Enable WP_DEBUG logging (with display disabled) to identify whether front-end memory errors are occurring.
What does the byte count in the error message tell me?
The byte count shows exactly how much memory PHP was allowed: 134,217,728 bytes = 128MB; 268,435,456 bytes = 256MB. The error also shows how much additional memory the process was trying to allocate when it hit the limit. A small shortfall (a few MB) suggests a modest memory limit increase will resolve the issue. A large shortfall (50MB or more for a routine operation) suggests a plugin is consuming memory unexpectedly — worth investigating before simply raising the limit.
Can too many plugins cause memory exhaustion?
Yes. Each active plugin loads additional PHP code, data, and potentially its own database queries into memory on every page load. A site running 40-50 plugins — especially older or poorly optimized ones — can see baseline memory consumption that a leaner site never approaches. Regular plugin audits — deactivating and deleting plugins that aren’t actively necessary — improve memory efficiency regardless of whether you’re currently seeing memory errors. It’s good site hygiene.
Related Glossary Terms
- White Screen of Death (WSOD)
- Fatal Error (Allowed Memory Size)
- Maximum Execution Time Exceeded
- Parse or Syntax Errors
- Debug Mode (WP_DEBUG)
- PHP
- wp-config
- 500 Internal Server Error
How CyberOptik Can Help
Still broken? Our team fixes WordPress errors like this in under 30 minutes for maintenance clients. Memory exhausted errors are often symptomatic of deeper configuration or plugin issues — not just a number that needs to be raised. We handle WordPress troubleshooting regularly, from identifying which plugin is leaking memory to recommending hosting configurations that match your site’s actual requirements. Contact us to discuss your site or explore our WordPress maintenance services.


