You're working inside your WordPress dashboard — installing a plugin, running an import, or simply loading a page — and suddenly you see this:
Or your site throws a White Screen of Death with no visible message at all.
This is the WordPress Memory Exhausted Error — and it means PHP ran out of the memory it was allocated to run your WordPress site and stopped dead in its tracks.
It's one of the most common WordPress errors, especially on shared hosting plans — and it's almost always fixable in under five minutes. This guide covers every method to increase your PHP memory limit, from the simplest one-line fix to server-level solutions.
Every time someone loads a page on your WordPress site, PHP executes code — loading WordPress core, your active theme, every active plugin, and the content from your database — all in memory.
Your hosting server allocates a fixed amount of RAM for each PHP process. This is called the PHP memory limit. If your WordPress installation tries to use more memory than this limit allows, PHP throws a fatal error and stops executing.
The error message looks like one of these:
Fatal error: Allowed memory size of X bytes exhaustedFatal error: Out of memory (allocated X) (tried to allocate X bytes)PHP Fatal error: Allowed memory size of 33554432 bytes exhaustedOr it may produce no visible message at all — just a White Screen of Death or a 500 Internal Server Error.
The number in the message is the current memory limit in bytes:
| Bytes | Equivalent |
|---|---|
| 33554432 | 32 MB |
| 67108864 | 64 MB |
| 134217728 | 128 MB |
| 268435456 | 256 MB |
WordPress officially recommends a minimum of 64 MB, and for most modern sites with multiple plugins, 256 MB is a more realistic requirement.
Method 1: Via WordPress admin (easiest)
Method 2: Create a temporary phpinfo file
phpinfo.php in your WordPress root directory via FTP<?php phpinfo(); ?>
https://yourdomain.com/phpinfo.php in your browsermemory_limitThis is the recommended first approach. Adding a single line to wp-config.php tells WordPress to request more memory from PHP.
wp-config.php/* That's all, stop editing! Happy publishing. */
define( 'WP_MEMORY_LIMIT', '256M' );
For wp-admin specifically, add a second line for admin operations (imports, updates, media processing):
define( 'WP_MEMORY_LIMIT', '256M' );
define( 'WP_MAX_MEMORY_LIMIT', '512M' );
WP_MEMORY_LIMIT applies to front-end page loads. WP_MAX_MEMORY_LIMIT applies to admin-side operations. WordPress passes these requests to PHP, which honours them up to the server's maximum allowed limit.If editing wp-config.php didn't work — or if your host requires memory limits to be set at the Apache level — add this line to your .htaccess file:
php_value memory_limit 256M
Open .htaccess via FTP (remember to show hidden files), add the line near the top of the file above the # BEGIN WordPress block, and save.
The php.ini file is PHP's main configuration file. Editing it directly gives you the most control — but not all hosting plans allow you to modify it.
Option A: Create a local php.ini in your WordPress root
Some hosting providers allow a local php.ini that overrides the server's global settings:
memory_limit = 256M
Create this file and upload it to your WordPress root directory via FTP.
Option B: Edit the global php.ini (VPS and dedicated servers)
If you have root access to your server:
# Locate the php.ini file
php --ini
# Open the file
sudo nano /etc/php/8.1/apache2/php.ini
# Find and update the line
memory_limit = 256M
# Save and restart your web server
sudo systemctl restart apache2
# or for Nginx with PHP-FPM:
sudo systemctl restart php8.1-fpm
Many hosting providers let you change the PHP memory limit directly from the control panel — no file editing required.
In cPanel:
memory_limit setting256M or 512MIn Plesk:
memory_limit and update the valueIn SiteGround Site Tools:
memory_limit and increase the valueIn Cloudways:
memory_limit and increase itIf none of the above methods work, your hosting plan likely has a hard server-side cap on PHP memory that cannot be overridden from within WordPress or configuration files.
This is common on entry-level shared hosting plans. When you contact your hosting provider, ask them:
Most good hosts will either increase the limit for you or tell you what their maximum is. If their maximum is still insufficient, it may be time to upgrade your hosting plan or switch providers.
Signs your hosting plan's memory limit is too low:
WP_MEMORY_LIMIT in wp-config.phpAfter applying any of the methods above, verify the new limit is actually in effect:
Increasing the memory limit solves the immediate error — but if your site is genuinely pushing against memory limits, it's worth also addressing the root cause.
| Site Type | Recommended Memory Limit |
|---|---|
| Simple blog or brochure site (5–10 plugins) | 128 MB |
| Business site with contact forms, SEO, caching (10–20 plugins) | 256 MB |
| WooCommerce store with payment gateways and extensions | 256 MB – 512 MB |
| Membership site or LMS with many concurrent users | 512 MB+ |
| High-traffic site with page builder, SEO, and custom functionality | 512 MB+ |
When in doubt, 256 MB is a safe all-round starting point for most WordPress sites.
| Method | Where to Edit | Best For |
|---|---|---|
| Add WP_MEMORY_LIMIT to wp-config.php | wp-config.php | All WordPress sites — try this first |
| Add php_value to .htaccess | .htaccess | Apache servers with PHP as module |
| Edit or create php.ini | WordPress root or server | Hosts that support local php.ini |
| Use hosting control panel | cPanel / Plesk / Host dashboard | Non-technical users with supported hosts |
| Contact hosting provider | Support ticket or live chat | When server has a hard cap you can't override |
yourdomain.com/phpinfo.php (if you've created the temporary file) and search for memory_limit.
The WordPress Memory Exhausted Error is one of the most fixable problems in all of WordPress. In most cases, adding a single line to wp-config.php resolves it completely in under a minute.
If the error keeps coming back even after increasing the memory limit, that's a signal to investigate further — audit your plugins, profile your memory usage with Query Monitor, and consider whether your current hosting plan is adequately resourced.
Contact us today and we'll get your site running smoothly