If you’ve ever seen a “Fatal error: Allowed memory size of X bytes exhausted” message on your WordPress site, you’re not alone. This is known as the WordPress Memory Exhausted error, and it’s one of the most common PHP-related issues WordPress users face.

The good news? It’s usually simple to fix – and you don’t need to be a developer to do it.

In this step-by-step guide, you’ll learn what causes the error, how to fix it by increasing your PHP memory limit, and what to do if you’re still stuck. We’ve also included internal resources and cited documentation from WordPress, PHP.net, and Apache.

📚 Table of Contents

❓ What Causes the WordPress Memory Exhausted Error?

WordPress runs on PHP, and each hosting environment allocates a certain amount of memory for PHP scripts. If your plugins, theme, or site activity exceeds this limit, you’ll encounter the memory exhausted error.

You might see messages like:

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

This can happen when:

  • Uploading large media files
  • Running heavy plugins like WooCommerce or Elementor
  • Importing content or using backup/migration tools
  • Performing admin actions like updating plugins or regenerating thumbnails

By increasing your memory allocation, you give WordPress more room to operate.

✅ Method 1: Increase PHP Memory via wp-config.php

  1. Connect to your site using FTP or your file manager
  2. Navigate to the root of your WordPress installation
  3. Open the wp-config.php file
  4. Just above the line that says:
/* That's all, stop editing! Happy blogging. */

Add this:

define('WP_MEMORY_LIMIT', '256M');
  1. Save the file and re-upload it if needed

🔗 Need help editing config files? See our guide to editing wp-config.php safely.

✅ Method 2: Update .htaccess to Raise Memory Limit

If your server uses Apache, you can also try editing .htaccess:

  1. Go to the root directory of your WordPress install
  2. Locate the .htaccess file (enable hidden files if you don’t see it)
  3. Add this at the bottom:
php_value memory_limit 256M
  1. Save the file and test your site

⚠️ Not all servers allow changes via .htaccess. If you see a 500 error, remove the line and try another method.

✅ Method 3: Use php.ini (if your host allows it)

Some hosts allow custom php.ini files. Here’s how to use one:

  1. Create a new file named php.ini
  2. Add this line:
memory_limit = 256M
  1. Upload it to the /wp-admin/ directory of your WordPress site

More on this in our PHP settings guide.

✅ Method 4: Ask Your Hosting Provider to Increase It

If the above methods don’t work, your host may restrict custom memory changes. In that case, just ask them directly:

  • Explain that you’re seeing the “memory exhausted” error
  • Request an increase to 256MB or higher

🛠️ Pressillion clients can increase memory via SSH or request the increase from the support dashboard.

🔒 Preventing Memory Errors in the Future

  • Keep your plugins lean: Disable or delete plugins you’re not using
  • Monitor memory usage: Some security and performance plugins offer this
  • Use managed hosting: At Pressillion, we proactively monitor PHP memory and increase limits as needed

Want help troubleshooting site errors faster?

🤔 FAQ: PHP Memory in WordPress

What is the default PHP memory limit for WordPress?
It’s usually 64MB, but some hosts set it to 128MB or even higher.

Is 256M too much?
No – it’s a common setting for modern plugins, WooCommerce, or site builders.

Do I need to restart anything after increasing memory?
No. Just refresh your site and test. If you’re using a cache plugin, clear the cache.

What if none of the fixes work?
Then it’s likely a host-level restriction. Contact your hosting provider for help.

🔗 Sources

Want hosting that handles all of this for you? Try Pressillion – we monitor and manage your PHP limits so your site stays fast and stable.

Related Reading