#WordPress Solutions #Bug Fixes #Guides & Tutorials

Fix Memory Exhausted Error – Increase PHP Memory in WordPress

WordPress memory exhausted error

If you’ve ever come across a fatal error message saying “Allowed memory size exhausted” on your WordPress website, don’t worry—you’re not alone. This is a common error, and the good news is that it’s easy to fix this Memory Exhausted Error.

In this guide, we’ll walk you through what causes the WordPress memory exhausted error and how to increase PHP memory in WordPress like a pro, even if you’re not a developer. Let’s fix it step-by-step!

1. What is the WordPress Memory Exhausted Error?

WordPress is built using PHP, a server-side programming language. Your web hosting server allocates a specific amount of memory that PHP scripts can use. When your website exceeds this limit, WordPress throws a fatal error like this.

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate XXXX bytes)

This is known as the WordPress memory exhausted error, and it usually happens when plugins, themes, or custom scripts consume more memory than what’s available.

2. Common Causes of PHP Memory Exhaustion

Let’s understand what might be eating up your memory:

  • A poorly coded plugin or theme
  • Too many active plugins
  • Heavy processes (image imports, backups, etc.)
  • High-site traffic or large database queries
  • Shared hosting with low memory allocation

By default, WordPress tries to allocate 40MB for single sites and 64MB for multisite installations, which is often not enough.

3. How to Increase PHP Memory in WordPress (Step-by-Step)

Here are different methods to increase the PHP memory limit on your WordPress site. You can try them based on the level of access your hosting provider gives you.

1. Increase Memory via wp-config.php

This is one of the safest and most commonly used methods.

Steps:

  1. Log in to your hosting panel (cPanel/File Manager or FTP).
  2. Locate the wp-config.php file at the root of your WordPress installation.
  3. Add the following line just before the line that says /* That's all, stop editing! */ :

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

This tells WordPress to raise its memory limit to 256MB.

2. Modify the php.ini File

This is ideal for users on VPS or dedicated servers.

Steps:

  1. Access your hosting panel and go to your file manager or use FTP.
  2. Look for the php.ini file in the root or public_html folder.
  3. Add or edit the following line:

memory_limit = 256M

Save the file and check if the error has been resolved.

3. Edit .htaccess File (Advanced)

If your host supports it, you can use the .htaccess file to change memory settings.

Steps:

  1. Go to your WordPress root directory.
  2. Open or create a .htaccess file.
  3. Add the following line:

php_value memory_limit 256M

Note: This may not work on all shared hosts and could result in a 500 error. Test carefully.

4. Hosting Panel Option (For Beginners)

Some hosting providers like Hostinger, Bluehost, or SiteGround provide an option to increase memory from their dashboard.

Steps:

  1. Log in to your hosting account.
  2. Go to the PHP settings or PHP configuration area.
  3. Look for the “memory_limit” field and change it to 256M or higher.
  4. Save changes.

5. Still Not Working?

If none of the methods are working, your host may have a server-level restriction.

Here’s what to do:

  • Contact your hosting support
  • Request them to increase your PHP memory limit
  • If needed, consider upgrading to a better hosting plan

6. Pro Tips to Avoid Running Out of Memory

Even after fixing the issue, memory exhaustion can return if your site isn’t optimized. Here are a few smart habits:

  • Deactivate and delete unused plugins
  • Use lightweight themes
  • Optimize images before uploading
  • Install a caching plugin (like WP Rocket or W3 Total Cache)
  • Avoid auto-importing large files frequently

7. How Much Memory Should You Allocate?

  • For blogs and small business sites: 128MB – 256MB is sufficient.
  • For WooCommerce stores or membership sites: 256MB – 512MB is better.
  • If you’re running custom applications or large sites: 512MB or more might be needed.

8. Quick Summary

MethodDescription
wp-config.phpThe easiest method to set a memory limit
php.iniServer-level change for memory limit
.htaccessConditional method works on some servers
Hosting PanelUse GUI to increase memory via settings
Hosting SupportAsk for assistance if all else fails

Frequently Asked Questions (FAQ)

Q: What is the default memory limit in WordPress?

Q: Is it safe to increase PHP memory?

Q: What’s the ideal PHP memory limit for WooCommerce?

Q: What happens if I set the memory too high?

Q: Can plugins help with this?

📝 Final Thoughts

Running into the WordPress memory exhausted error can be frustrating, but now you know exactly how to fix it. Whether it’s through editing wp-config.php, updating php.ini, or getting help from your hosting provider, solving the problem is easier than it sounds.

By increasing the PHP memory limit, you make your site more stable, more scalable, and ready for growth. Don’t let a technical error slow you down—your website deserves peak performance!

Fix Memory Exhausted Error – Increase PHP Memory in WordPress

How to Check Your Amazon Orders: Quick

Fix Memory Exhausted Error – Increase PHP Memory in WordPress

Top 10 iPhone 16 Pro Max Case