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.
Common default memory limits:
| 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
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.
Step 1: Connect to your server via FTP or open your hosting file manager
Step 2: Open wp-config.php from your WordPress root directory
Step 3: Find this comment near the bottom of the file:
/* That's all, stop editing! Happy publishing. */
Step 4: Add this line directly above that comment:
define( 'WP_MEMORY_LIMIT', '256M' );
Step 5: Save the file and reload your website.
For wp-admin specifically, you can also add a second line:
define( 'WP_MEMORY_LIMIT', '256M' );
define( 'WP_MAX_MEMORY_LIMIT', '512M' );
WP_MAX_MEMORY_LIMIT applies to admin-side operations, while WP_MEMORY_LIMIT applies to front-end page loads.
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 in the WordPress root directory:
php_value memory_limit 256M
The php.ini file is PHP's main configuration file. Editing it directly gives you the most control over the memory limit — but not all hosting plans allow you to modify it.
Option A: Local php.ini in WordPress root:
php.ini file already exists in your WordPress rootmemory_limit line and change its value to 256Mphp.ini exists, create one with this single line: memory_limit = 256MOption B: Edit the global php.ini (VPS and dedicated servers):
# Find the php.ini location
php --ini
# Open it in an editor
sudo nano /etc/php/8.1/apache2/php.ini
# Update the memory_limit
memory_limit = 256M
# Restart 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 and change the value to 256MIn 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.
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 (e.g., 64 MB on a very restrictive plan), it may be time to upgrade your hosting plan or switch providers.
WP_MEMORY_LIMIT mean your hosting provider's server-side configuration overrides your local settings. Try the next method in the list — some hosting environments prioritise certain configuration files over others.If the Site Health panel still shows the old limit, the change didn't take effect. Try the next method in the list — some hosting environments prioritise certain configuration files over others.
Increase 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 | 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 / SiteGround / Cloudways | Non-technical users with supported hosts | Contact hosting provider | Support ticket | When server has a hard cap you can't override |
|---|
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 returning after increasing the 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 for your site's needs.
Need help diagnosing persistent memory issues or optimising your WordPress site for better performance? Our team of WordPress developers can audit your setup and recommend the right fix.
Contact us today