WordPress Memory Limit Exhausted: PROVEN Fix Guide (2026)

✍️ By Vikas Rohilla 📅 Updated: March 2026 ⏱️ 9 min read 🏷️ WordPress Errors

You are working in your WordPress dashboard — installing a plugin, uploading an image, or running a backup — and suddenly everything stops:

“Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 2097152 bytes)”

Or more recently in WordPress 6.x, the more cryptic: “There has been a critical error on this website.”

Both mean the same thing: your site hit the WordPress memory limit and PHP stopped working.

Here is what most guides do not tell you — simply increasing the number is a temporary patch, not a real fix. If you keep hitting the WordPress memory limit, something on your site is consuming far more memory than it should. This guide covers not just how to increase the limit, but how to find what is causing the problem and fix it permanently.

⚡ Quick fix first: Add this line to wp-config.php before the “stop editing” comment:

define( ‘WP_MEMORY_LIMIT’, ‘256M’ );

This resolves most WordPress memory limit errors immediately. If the error keeps coming back — read on for the permanent fix.
wordpress memory limit exhausted fatal error allowed memory size browser message
The WordPress memory limit error — “Fatal error: Allowed memory size exhausted” — PHP stops working when your site exceeds the allocated memory ceiling

What Is the WordPress Memory Limit?

Every time someone visits a page on your WordPress site, PHP runs on your server — executing your theme’s code, running active plugins, querying the database, and assembling the page. All of this work consumes RAM on your server.

The WordPress memory limit is a cap on how much RAM PHP is allowed to use for a single request. When a page load or admin action tries to exceed this cap, PHP stops immediately and throws the memory exhausted error.

There are actually two separate WordPress memory limit settings you need to understand:

SettingControlsWhere to SetRecommended
WP_MEMORY_LIMITFrontend visitors — page loadswp-config.php128M–256M
WP_MAX_MEMORY_LIMITAdmin panel, cron jobs, WP-CLIwp-config.php256M–512M
memory_limitServer-level hard capphp.ini / hPanel256M+

The most important thing to understand: WordPress cannot exceed the server-level memory limit no matter what you set in wp-config.php. If your hosting plan allocates 64MB at the server level, setting WP_MEMORY_LIMIT to 512M in wp-config.php will have zero effect. You need to increase both.

How Much Memory Does Your WordPress Site Actually Need?

📊 PHP Memory Requirements by Site Type:

Basic blog
64MB
Business site
128MB
Elementor/Divi
256MB
WooCommerce
256MB+
Membership site
512MB

Step 1 — Check Your Current WordPress Memory Limit

Before increasing anything, check what your current WordPress memory limit actually is. There are two quick ways:

Method A — WordPress Site Health

  1. Go to WordPress Dashboard → Tools → Site Health
  2. Click the Info tab
  3. Expand Server section
  4. Look for PHP memory limit — this shows the server-level cap
  5. Also look for WordPress memory limit — this shows the WP_MEMORY_LIMIT value
wordpress site health info server php memory limit current value
WordPress → Tools → Site Health → Info → Server — shows your current PHP memory limit and WordPress memory limit values before making any changes

Method B — Add Temporary Debug Code

Add this line temporarily to any theme’s functions.php file to display current memory usage:

echo ‘Memory limit: ‘ . ini_get(‘memory_limit’); echo ‘ | Used: ‘ . round(memory_get_usage()/1024/1024, 2) . ‘MB’;

Visit your site, note the values, then remove this line immediately.

Fix 1: Increase WordPress Memory Limit in wp-config.php (Fastest)

This is the first and most reliable method to fix a WordPress memory limit error. It works on virtually all hosting environments and takes under 2 minutes.

  1. Open Hostinger hPanel → File Manager → public_html
  2. Find wp-config.php → right-click → Edit
  3. Find the line that says /* That’s all, stop editing! */
  4. Paste these two lines immediately before that comment:
define( ‘WP_MEMORY_LIMIT’, ‘256M’ ); define( ‘WP_MAX_MEMORY_LIMIT’, ‘512M’ );
  1. Save the file → Click Save & Close
  2. Refresh your site and attempt the action that caused the error
wp-config.php wordpress memory limit WP_MEMORY_LIMIT line highlighted cpanel
wp-config.php — add WP_MEMORY_LIMIT and WP_MAX_MEMORY_LIMIT before the “stop editing” comment — the fastest fix for the WordPress memory limit error
💡 WP_MEMORY_LIMIT vs WP_MAX_MEMORY_LIMIT: Set WP_MEMORY_LIMIT for your frontend visitors (128M–256M). Set WP_MAX_MEMORY_LIMIT higher (256M–512M) for admin operations — backups, plugin installations, and media uploads all run in admin context and need more RAM. Most guides only set one — set both.

Fix 2: Increase PHP Memory Limit via Hostinger hPanel

If the wp-config.php method did not resolve the memory limit error, the server-level PHP memory cap is lower than what you set in WordPress. You need to increase it at the hosting level.

  1. Log into Hostinger hPanel
  2. Scroll down to the Advanced section
  3. Click PHP Configuration
  4. Find the memory_limit field
  5. Change the value to 256M (or 512M for resource-heavy sites)
  6. Click Save
  7. Go back to WordPress and test the action that caused the error
hostinger hpanel php configuration memory limit setting the limit fix
Hostinger hPanel → Advanced → PHP Configuration → memory_limit — increase to 256M to raise the server-level PHP memory cap that limits your this limit
📖 Related: PHP memory exhaustion is one of the top causes of 500 errors. After increasing your memory limit, read the full 500 Internal Server Error WordPress Guide — memory fix is Fix 4 of 7 complete solutions.
✅ Hostinger users: Hostinger’s PHP Configuration panel is the cleanest way to increase your server-level memory limit — no need to edit php.ini files manually. The change takes effect immediately without a server restart.
📖 Related: Low PHP memory causes update timeouts — which is one of the most common reasons WordPress gets stuck in maintenance mode. Fix your memory limit first to prevent future update failures.

Fix 3: Increase Memory Limit via .htaccess

If neither wp-config.php nor hPanel resolved the PHP memory error, try the .htaccess method. This works on Apache servers where PHP runs as an Apache module.

  1. Open cPanel → File Manager → public_html
  2. Enable Show Hidden Files → find .htaccess
  3. Right-click → Edit
  4. Add this line at the very top of the file:
php_value memory_limit 256M
  1. Save the file → test your site
⚠️ Note: The .htaccess method only works if your hosting uses Apache with mod_php. On LiteSpeed servers (like Hostinger), use the hPanel PHP Configuration method instead — it is more reliable and directly supported.
📖 Related: A memory cap error is often confused with the WordPress White Screen of Death — both cause site-wide crashes. WSOD is a PHP fatal error that can be caused by exceeding the memory limit, but has additional causes and fixes beyond memory alone.

The Real Fix: Find What Is Consuming Your Memory

Increasing the the memory cap stops the error — but it does not fix the underlying problem. If your site keeps hitting the limit, something is consuming abnormally high amounts of memory. Finding and fixing that is what permanently resolves the issue.

Think of it this way: increasing the memory limit is putting a bigger bucket under a leaking roof. The leak is still there.

How to Identify Memory Hogs — Query Monitor Plugin

  1. Install Query Monitor plugin (free)
  2. Visit different pages on your site with Query Monitor active
  3. The toolbar at the top shows memory usage per page load in real time
  4. Go to Query Monitor → PHP Errors to see memory-related warnings
  5. Go to Query Monitor → Scripts to see which plugins are loading the most JavaScript
  6. The page with the highest memory usage = start your investigation there
query monitor plugin showing memory usage per page memory limit debugging
Query Monitor plugin — shows real-time PHP memory usage per page load, database queries, and plugin performance — the most reliable way to find what is exhausting your the limit

Common Memory Culprits — And Their Fixes:

🔴 Backup Plugins

Running a full backup can consume 200-500MB temporarily. Schedule backups during off-peak hours (3–5am) and use incremental backups if available.

🔴 Page Builders

Elementor, Divi, and Beaver Builder are memory-intensive. Keep them updated — newer versions are significantly more efficient than older ones.

🟡 Analytics Plugins

Plugins that run their own tracking (MonsterInsights, Jetpack Stats) load significant data. Consider using Google Analytics directly via code instead.

🟡 Security Scanners

Real-time malware scanners scan every file on every request. Schedule scans instead of running them continuously — a massive memory saving.

🔵 Too Many Plugins

Every active plugin consumes memory even if not used on the current page. Audit your plugins quarterly — delete anything not actively needed.

🟢 Large Image Uploads

WordPress creates multiple resized versions of every uploaded image — memory-intensive for large files. Compress images before uploading using Squoosh.

📖 Related: Memory-hungry plugins directly impact your Core Web Vitals and PageSpeed scores. After fixing your memory limit, read WordPress Speed Optimization Guide and Fix INP in WordPress to restore your performance scores.

Advanced: Increase PHP Memory via php.ini

If none of the above methods work for your specific hosting setup, editing the php.ini file directly raises the server-level memory cap:

  1. Go to cPanel → File Manager → public_html
  2. Check if a php.ini file already exists — if not, create a new file with that exact name
  3. Add this line:
memory_limit = 256M
  1. Save and test your site
💡 Note: On Hostinger, the hPanel PHP Configuration method (Fix 2) is more reliable than editing php.ini manually — use that first. The php.ini method is a fallback for hosting environments without a visual PHP configuration panel.

When to Consider Upgrading Your Hosting Plan

Sometimes a recurring this limit error is not a configuration problem — it is a sign that your site has genuinely outgrown its current hosting plan’s resource allocation.

  • You have set memory to 256M but still regularly hit the limit
  • Your site runs WooCommerce, a membership plugin, or multiple page builders simultaneously
  • Traffic has grown significantly and memory errors appear during peak periods
  • Backup jobs consistently fail due to memory exhaustion
  • Your hosting plan’s maximum PHP memory limit is below 256MB

Outgrowing your current hosting plan?

Hostinger Business and Cloud plans include higher PHP memory limits, dedicated resources, and priority support — built for growing WordPress sites that need more than shared hosting can offer.

Upgrade Hosting →

How to Prevent PHP memory Errors

  • Set memory correctly from the start: When installing WordPress, add both WP_MEMORY_LIMIT and WP_MAX_MEMORY_LIMIT to wp-config.php immediately. Do not wait for the error to appear.
  • Audit plugins quarterly: Deactivate and delete any plugin you are not actively using. Even deactivated plugins can sometimes consume memory — delete them entirely.
  • Compress images before uploading: Use Squoosh (free) to compress images before uploading to WordPress. Smaller files = less memory consumed during processing.
  • Security scanner memory: If you recently recovered from a hack, your security scanner may be running continuously consuming excess memory. Read WordPress Site Hacked Recovery Guide to configure it correctly.
  • Schedule heavy operations: Configure backup plugins to run at 3–5am when traffic is lowest. Memory-intensive operations during peak traffic is the most common cause of intermittent memory errors.
  • Monitor memory usage: Keep Query Monitor installed (even if inactive) and check memory usage occasionally — catching a memory leak early is far easier than dealing with a crashed site.
  • Update PHP version: PHP 8.x is significantly more memory-efficient than PHP 7.x. Update via hPanel → PHP Configuration. Newer PHP versions handle the same operations using less RAM.
📖 Related: High memory usage directly affects your TTFB — the time it takes for your server to start responding. Read Why TTFB Is Critical in 2026 and Fix LCP in WordPress to understand how memory and server performance connect.
🔍

Free WordPress Technical Audit — ToolXray

After fixing your memory limit — check Core Web Vitals, PageSpeed, TTFB and 80+ technical signals. Free, no signup needed.

Run Free Audit →

The Bottom Line

A memory cap error is one of the most fixable problems in WordPress — but only if you address both the symptom and the cause. Increasing WP_MEMORY_LIMIT in wp-config.php and raising the server-level cap in hPanel resolves the immediate error in minutes.

But the real work is finding what is consuming the memory in the first place. Query Monitor makes this straightforward — run it, find the memory hog, fix or replace it. A site that operates well within its the memory cap is faster, more stable, and far less likely to crash during traffic spikes or admin operations.

Set your memory correctly, audit your plugins regularly, and schedule heavy operations for off-peak hours. These three habits eliminate memory errors permanently.

🔍 Free WordPress Technical Audit

Check PageSpeed, Core Web Vitals, TTFB and 80+ technical signals after fixing your memory limit

Run Free Audit at ToolXray →
📖 Also useful: Not sure which theme or plugins are running heavy scripts on your site? Use the free WordPress Theme & Plugin Analyzer to identify resource-heavy plugins. Also check How to Use PageSpeed Insights to measure the impact of your memory fixes.

Related Articles

💀

WordPress White Screen of Death

Memory limit errors often cause WSOD — 9 fixes including memory and PHP solutions.

🗄️

WordPress Database Error Fix

Another site-wide crash error — different cause, same panic. 6 proven fixes.

🔴

WordPress 404 Error Fix

Pages returning “not found”? Complete fix guide — 7 solutions.

🚀

WordPress Speed Optimization

After fixing memory — optimize for PageSpeed 90+ scores and faster load times.

⏱️

Why TTFB Is Critical in 2026

High memory usage spikes your TTFB — here is how to monitor and fix server response time.

🆓

Free Alternative to Ahrefs

Monitor your site’s technical health for free — no $99/month subscription needed.

Frequently Asked Questions

❓ What is the recommended memory limit in 2026?
For most WordPress sites in 2026, set WP_MEMORY_LIMIT to 256M and WP_MAX_MEMORY_LIMIT to 512M in wp-config.php. The server-level PHP memory_limit should be at least 256M — set via your hosting panel. Basic blogs can run on 128M, but sites using page builders like Elementor, WooCommerce, or multiple active plugins typically need 256M as a minimum. Membership sites and high-traffic sites may need 512M or more.
❓ Why does the the limit error keep coming back after I increase it?
If the error returns after increasing your this limit, a plugin or process on your site has a memory leak — it is consuming abnormally high memory that grows over time. The most common culprits are backup plugins running during peak traffic, security scanners set to run continuously, outdated page builders, or analytics plugins with their own tracking. Install Query Monitor (free) to see memory usage per page and identify the problem plugin.
❓ How do I increase the PHP memory without cPanel access?
If you do not have cPanel access, add define(‘WP_MEMORY_LIMIT’, ‘256M’) and define(‘WP_MAX_MEMORY_LIMIT’, ‘512M’) directly to your wp-config.php file via FTP (FileZilla). Connect to your server via FTP, navigate to public_html, download wp-config.php, edit it in a text editor, and upload it back. This method works on virtually all hosting environments regardless of control panel access.
❓ What is the difference between WP_MEMORY_LIMIT and WP_MAX_MEMORY_LIMIT?
WP_MEMORY_LIMIT controls the PHP memory available for frontend page loads — what your visitors trigger when browsing your site. WP_MAX_MEMORY_LIMIT controls memory for backend operations — logging into wp-admin, installing plugins, running backups, executing WP-CLI commands, and scheduled cron jobs. Admin operations are more memory-intensive, so WP_MAX_MEMORY_LIMIT should always be set higher than WP_MEMORY_LIMIT. Most guides only mention WP_MEMORY_LIMIT — setting both is the correct approach.
❓ Does increasing the memory cap affect site speed?
Increasing the the memory cap does not slow your site — it simply raises the ceiling of how much RAM PHP can use. However, if a plugin is consuming excessive memory, that plugin itself will slow your site whether or not you hit the limit. The speed improvement comes from finding and fixing the memory-heavy plugin or process, not just from increasing the limit. After resolving memory issues, run a complete technical SEO audit to confirm your PageSpeed and Core Web Vitals scores are where they should be.

    Leave a Comment

    Your email address will not be published. Required fields are marked *

    Scroll to Top