|

WordPress Memory Exhausted Error: How to Increase PHP Memory Limit Safely?

wordpress memory exhausted
WordPress memory exhausted error

You’re working on your WordPress site, everything seems fine – and suddenly you see this message:

Fatal error: Allowed memory size of X bytes exhausted

Or maybe your site stops loading, the admin panel crashes, or updates fail without explanation.

This is known as the WordPress memory exhausted error, and it’s one of the most common issues beginners face.

The good news?
1. This error is not dangerous
2. It does NOT mean your site is broken
3. It can be fixed safely, even if you’re not technical

In this guide, I’ll explain what the WordPress memory exhausted error actually means, why it happens, and show you multiple safe ways to increase PHP memory limit in WordPress – step by step.

No risky shortcuts. No guesswork.

What Is the WordPress Memory Exhausted Error?

WordPress runs on PHP, and PHP is allocated a limited amount of memory by your hosting server.

When your website tries to use more memory than allowed, PHP stops execution and throws this error.

Common error messages include:

  • Allowed memory size of 134217728 bytes exhausted
  • Fatal error: Out of memory
  • WordPress memory limit exhausted
  • Site crashes after installing a plugin or theme

This usually happens when:

  • A plugin consumes too much memory
  • A theme is poorly optimized
  • Your site has grown but memory limits stayed low

Why WordPress Runs Out of Memory (Real Reasons)

Let’s break it down in simple terms.

1. Low Default PHP Memory Limit

Many hosts set PHP memory as low as 64MB or 128MB, which is not enough for modern WordPress sites.

2. Heavy Plugins

Page builders, security plugins, backup tools, and ecommerce plugins often need more memory.

3. Poorly Coded Themes or Plugins

Some plugins keep running processes in the background and consume memory continuously.

4. WooCommerce or Large Sites

Product pages, filters, and checkout processes use more PHP memory.

5. Multiple Issues Combined

Sometimes the memory error appears along with other problems, such as:

If that’s the case, fix those first before increasing memory.

How Much PHP Memory Does WordPress Need?

Here’s a safe guideline:

Website Type

Recommended PHP Memory

Basic blog

128MB

Business site

256MB

WooCommerce

256MB – 512MB

Heavy plugins / builders

512MB

256MB is safe for most sites

Step 1: Check Your Current WordPress Memory Limit

Before changing anything, check what you’re currently using.

Method 1: From WordPress Dashboard

  1. Go to Tools → Site Health
  2. Open the Info tab
  3. Expand Server
  4. Look for:
    • PHP memory limit
    • WP memory limit

Method 2: Ask Your Hosting Panel

Some hosts show this directly inside cPanel or hPanel.

Step 2: Increase WordPress Memory Limit via wp-config.php (Safest Method)

This is the most recommended and safest method.

Steps:

  1. Open File Manager or FTP
  2. Locate wp-config.php
  3. Add this above the line:
  4. /* That’s all, stop editing! */
define( 'WP_MEMORY_LIMIT', '256M' ); define( 'WP_MAX_MEMORY_LIMIT', '256M' ); 
  1. Save the file
  2. Refresh your site
  • Works for most shared hosting
  • No risk if done correctly

Step 3: Increase PHP Memory via .htaccess

If the wp-config method doesn’t work, try this.

Steps:

  1. Open .htaccess
  2. Add at the end:
php_value memory_limit 256M 
  1. Save and refresh

If your site throws a 500 error after this, remove the line immediately.

Step 4: Increase PHP Memory from Hosting Control Panel

Many hosts restrict manual changes.

cPanel:

  1. Open MultiPHP INI Editor
  2. Select your domain
  3. Set:
    • memory_limit → 256M
  4. Save

Hostinger / Custom Panels:

  • Look for PHP Configuration
  • Increase memory limit
  • Apply changes

This method is very stable.

Step 5: Ask Your Hosting Provider (Often Overlooked)

If none of the above works, your host may be hard‑limiting memory.

Just ask support:

“Please increase PHP memory limit to 256MB for my domain.”

This takes 2 minutes and often solves the issue permanently.

Pro Tip!

If memory issues keep returning after every update, it’s a sign your site needs better optimization or hosting, not just higher limits.

Reduce Memory Usage (Very Important)

Increasing memory is good — but optimizing usage is better.

  1. Deactivate Unused Plugins

Even inactive plugins take resources.

  1. Replace Heavy Plugins

Avoid using multiple plugins doing the same job.

  1. Switch to a Lightweight Theme

Bloated themes drain memory constantly.

  1. Update PHP Version

PHP 8.x is faster and uses memory more efficiently than PHP 7.2.

Can Plugins Fix WordPress Memory Exhausted Error?

Short answer: No (not safely).

Plugins can:

  • Hide the error
  • Delay the crash

But they cannot increase server memory.

Always fix memory issues at the server level.

When Memory Errors Cause Bigger Problems

If your site:

You may be dealing with compound issues, not just memory.

In those cases, fix the root cause first, then adjust memory.

Related WordPress Issues (Recommended Reading)

FAQs: WordPress Memory Exhausted Error

Is it safe to increase PHP memory limit?

Yes, increasing up to 256MB is completely safe for WordPress.

Usually due to:

  • Plugin updates
  • New features added
  • Hosting restrictions

Often yes. Quality hosts allocate more resources automatically.

Only if you:

  • Run WooCommerce
  • Use heavy builders
  • Have large traffic

Final Thoughts

The WordPress memory exhausted error looks scary – but it’s one of the easiest WordPress problems to fix when handled correctly.

  1. Increase memory safely
  2. Optimize plugin usage
  3. Avoid unnecessary tools
  4. Fix related errors first

If you follow the steps above, your site will run faster, smoother, and more stable.

If you are unable to solve the error, contact us and we’ll review it for you.

Similar Posts

Leave a Reply

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