If your site just went blank or shows a message like Allowed memory size of 134217728 bytes exhausted, you have hit the WordPress PHP memory limit. It is the cap on how much RAM a single PHP process, the code that runs WordPress, is allowed to use before the server kills it. Cross the line and the page dies mid-render. The memory error is often a symptom, not the root cause.
The good news: raising the limit takes one line of code in most cases. This guide shows how to check your current limit, increase it through the method your host supports, and pick a value that actually holds. You do not need to be a developer to do the first pass.
If the blank page is your problem right now, our guide on the WordPress white screen of death covers the fastest recovery steps.
Key Takeaways
- WordPress asks PHP for only 40MB by default on a single site, and 64MB on multisite. That runs out quickly on modern plugin stacks. (WordPress Developer Docs, 2026)
- The admin area gets a separate, higher default of 256MB via WP_MAX_MEMORY_LIMIT, which is why the back end can fail while the front end loads.
- The cleanest fix is one line in wp-config.php: define( ‘WP_MEMORY_LIMIT’, ‘256M’ );.
- WooCommerce and most plugin-heavy sites need 256MB or more (WooCommerce Server Requirements, 2026).
- WordPress cannot exceed the ceiling your host sets in PHP. If your value is ignored, the host cap wins, and you must raise memory_limit at the server level or ask support.
What Is the PHP Memory Limit in WordPress?
The PHP memory limit is the maximum amount of RAM one PHP script may use while it runs. WordPress is PHP, so every page load, plugin task, and import runs inside that budget. When a process needs more than the limit allows, PHP stops it with a fatal error instead of letting it consume the whole server.
There are actually three separate numbers at play, and confusing them is the root of most failed fixes:
- WP_MEMORY_LIMIT` is what WordPress requests for normal front-end work. The default is 40MB on a single site and 64MB on multisite.
- WP_MAX_MEMORY_LIMIT` is the higher budget WordPress grants itself inside the admin dashboard, where updates and media work cost more. The default is 256MB.
- PHP’s own
memory_limitis the hard ceiling set on the server, with a stock default of 128MB (PHP Manual, 2026). WordPress can ask for more, but it can never rise above what the host permits here.
| Setting | Default | Where it applies |
| WP_MEMORY_LIMIT | 40MB (64MB multisite) | Front-end page loads |
| WP_MAX_MEMORY_LIMIT | 256MB | Admin dashboard tasks |
| PHP memory_limit | 128MB | Server-wide hard ceiling |

The Four Memory Numbers That Matter (Sources: WordPress Developer Docs, PHP Manual 2026)
| Setting | Default limit |
| WP front end, single site (WP_MEMORY_LIMIT) | 40MB |
| WP front end, multisite | 64MB |
| PHP server default (memory_limit) | 128MB |
| WP admin default (WP_MAX_MEMORY_LIMIT) | 256MB |
[Our Insight] The 40MB front-end default is the number almost nobody knows, and it explains a symptom that looks impossible: the dashboard works fine, but the live site is blank. The admin runs on the 256MB budget, so it survives. Visitors hit the same page on the 40MB budget and crash it. If your back end is healthy while the front end is down, memory is the first place to look, not the theme.
How Do You Know You Have Hit the Limit?
You have hit the memory limit when a page dies partway through loading, usually with a fatal error naming an exhausted memory size. The classic message reads:
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted
(tried to allocate 20480 bytes) in /path/to/file.php on line 123
That figure, 134217728 bytes, is simply 128MB written in bytes, so the message is telling you the server default has been maxed out. The number changes to match your current limit.
The same problem wears several disguises depending on your settings:
- A completely white page with no text, the white screen of death.
- A generic “There has been a critical error on this website” notice, which is how modern WordPress hides fatal errors from visitors. Our guide to the WordPress critical error breaks that one down.
- Failures during heavy jobs only: importing content, updating many plugins at once, running a backup, or editing a large page in the block editor.
If the crash happens during a big task and clears on a normal page, that is a strong memory signal rather than a broken plugin.
A memory-limit crash shows up as the PHP fatal error “Allowed memory size of N bytes exhausted,” where N is the current limit in bytes (134217728 equals 128MB). It also surfaces as the white screen of death or a generic critical-error notice, and it often appears only during memory-heavy tasks like imports, bulk updates, and backups (PHP Manual, 2026).
How to Check Your Current PHP Memory Limit?
Before you raise anything, confirm what you are working with. WordPress reports both its own limit and the server ceiling in one place. Go to Tools > Site Health > Info in your dashboard, open the Server section, and read the PHP memory limit line. That value is your live server cap.
Two other quick methods:
- The error message itself. The byte figure in the fatal error is your current PHP limit. 268435456 is 256MB, 134217728 is 128MB, 67108864 is 64MB.
- A one-line check file. Create a file named check.php with <?php echo ini_get(‘memory_limit’);, upload it to your site root, visit it in a browser, then delete it. It prints the exact server value.
Knowing both numbers, the WordPress request and the PHP ceiling, tells you which of the fixes below you actually need. If WordPress already asks for 256MB, but the ceiling is 128MB, editing wp-config.php again will do nothing, and you need a server-level change instead.
How to Increase the WordPress PHP Memory Limit?
You raise the memory limit by declaring a higher value in one of four files, depending on what your host allows. Start with wp-config.php, since it is the WordPress-native method and works on most hosts. If the value gets ignored, move down the list to a server-level change.

Method 1: Edit wp-config.php (start here)
Open wp-config.php in your site root using your host file manager or SFTP. Add these two lines above the line that reads /* That's all, stop editing! Happy blogging. */:
define( 'WP_MEMORY_LIMIT', '256M' );
define( 'WP_MAX_MEMORY_LIMIT', '512M' );
The first line lifts the front-end budget to 256MB. The second raises the admin ceiling to 512MB for heavy back-end jobs. Save the file and reload your site. This alone resolves the majority of memory errors.
Method 2: Edit php.ini
If wp-config.php has no effect, your host is enforcing a lower ceiling in PHP, and you need to raise it there. Find or create a php.ini file in your site root and add:
memory_limit = 256M
On many shared hosts, the active php.ini is locked, so this file may be ignored. That is expected, and it points you to Method 3 or 4.
Method 3: Edit .htaccess
On Apache servers, you can raise the limit through the .htaccess file in your site root. Add this line near the top:
php_value memory_limit 256M
Skip this method on NGINX or LiteSpeed servers, where .htaccess directives for PHP values are not read and can cause a 500 error. If the site breaks after this edit, remove the line.
Method 4: Edit .user.ini
Many modern hosts running PHP as FastCGI use a .user.ini file instead of php.ini for per-site overrides. Create .user.ini in your site root with:
memory_limit = 256M
Changes here can take a few minutes to apply because PHP caches the file. Wait, then recheck in Site Health.
Method 5: Ask your host or use the hosting panel
Managed and many shared hosts expose the PHP memory limit directly in their control panel, often under a “PHP settings,” “MultiPHP INI Editor,” or “Select PHP Version” area. Set it there and the change applies server-wide, overriding the file methods above. If you cannot find it, a one-line support request usually gets it raised within minutes, since hosts do this constantly.
[Our Experience] On WordPress audits, the single most common mistake we see is someone editing wp-config.php, seeing no change, and editing it three more times with bigger numbers. The file was never the problem. The host had a hard 128MB cap, and no amount of WordPress config could climb past it. Always confirm the change in Site Health after each edit. If the number does not move, stop editing files and go straight to the host.
How Much Memory Should You Set?
For most sites, 256MB is the right target. It clears the 40MB default by a wide margin, covers plugin-heavy setups, and matches what the biggest resource users ask for. WooCommerce, for instance, lists a WordPress memory limit of 256MB or greater as an official server requirement (WooCommerce Server Requirements, 2026).
Match the value to your site rather than setting the highest number you can:
| Site type | Recommended limit |
| Simple blog or brochure site | 128MB |
| Business site with a page builder | 256MB |
| WooCommerce store | 256MB+ |
| Large or heavily plugged site | 512MB |
More memory does not improve performance. The limit is a safety cap, not a speed setting, so raising it past what you need does not make pages faster. It only gives a runaway process more room to run before it fails. If 512MB still is not enough, you have a badly behaved plugin or a genuine scaling need, not a config problem. That is a code and hosting question, which our WordPress speed and performance guide gets into.
Why Your New Limit Sometimes Does Not Stick
If you raised the value and nothing changed, the host is capping PHP below your request, and the host always wins. WordPress asks PHP for more memory through ini_set(), but that request is subject to server rules. When the server forbids raising the limit or caps it lower, your wp-config.php number is quietly ignored.
Two things also matter here in 2026. First, run a current PHP version. WordPress recommends PHP 8.3 or greater, and PHP 8.x now serves the majority of all PHP sites at roughly 61.5%. Newer PHP releases manage memory more efficiently, so a modern version stretches the same limit further. Second, some managed hosts fix the limit deliberately and will not budge on the file methods, which is why the control panel or a support ticket is the reliable route on those platforms.
Before changing config on a live site, test on a copy. Our guide to setting up a WordPress staging environment shows how to make edits safely first.
Frequently Asked Questions
What is the default PHP memory limit in WordPress?
WordPress requests 40MB for a single site and 64MB for multisite on the front end, and grants its admin area 256MB by default. Those requests sit under PHP’s own server default of 128MB, which is the real ceiling unless your host sets it higher or lower.
Where do I put the WP_MEMORY_LIMIT line?
In wp-config.php, located in your site root, above the line that reads /* That’s all, stop editing! Happy blogging. */. Anything added below that line is not read. Use define( ‘WP_MEMORY_LIMIT’, ‘256M’ );.
I increased the limit but still get the error. Why?
Your host is enforcing a lower PHP ceiling, and it overrides the WordPress value. Confirm the live limit in Tools > Site Health > Info > Server. If it is not moving, raise memory_limit at the server level through php.ini, .user.ini, or the hosting panel, or ask your host to raise it.
Is a higher memory limit bad for performance?
No, and it does not help performance either. The limit is a cap, not an allocation, so a page that uses 30MB uses 30MB whether the ceiling is 128MB or 512MB. A very high limit only lets a faulty process consume more before it fails, so fix the underlying plugin rather than raising the cap indefinitely.
What memory limit does WooCommerce need?
WooCommerce lists a WordPress memory limit of 256MB or greater as an official server requirement (WooCommerce Server Requirements, 2026). Busy stores with many extensions often run comfortably at 512MB.
Conclusion
The WordPress memory limit trips up so many owners because the default is quietly small: 40MB on a single-site front end, against a 256MB admin budget and a 128MB server ceiling. Once you can see all three numbers, the fix is usually one line in wp-config.php and a recheck in Site Health.
Work it in order. Check your current limit, set WP_MEMORY_LIMIT to 256M, confirm the change took, and only reach for server-level files or your host if WordPress cannot climb past the ceiling. Match the value to the site, keep PHP current, and treat any need beyond 512MB as a plugin problem rather than a config one.
If the error keeps returning after all of this, something is leaking memory under the surface. Our WordPress audit pinpoints which plugin or query is eating the budget and what to do about it.