Summarize this article with:

Your site just crashed. The screen shows WordPress Fatal Error: Out of Memory and nothing else works.

This PHP error occurs when your server cannot allocate enough memory to run WordPress scripts. Plugins, themes, large images, or simply outgrowing your hosting plan can trigger it.

The fix takes about 10 minutes.

This guide walks you through five methods to increase your PHP memory limit and get your site back online. You will learn how to edit wp-config.php, modify php.ini, update .htaccess, and identify memory-hungry plugins causing the problem.

No coding experience required. Just FTP access and a text editor.

What Is WordPress Fatal Error: Out of Memory?

WordPress Fatal Error: Out of Memory is a PHP error that stops your site when scripts need more memory than your server allows.

You will see something like this:

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 2348617 bytes)

Sometimes your site just goes blank. That is the WordPress white screen of death showing up instead of an actual error message.

Other times you get the message there has been a critical error on this website.

Have you seen the latest WordPress statistics?

Discover the latest WordPress statistics: market share, security trends, performance data, and revenue insights that shape the web.

Check Them Out →

This happens when you install plugins, upload large images, or run resource-heavy processes on shared hosting.

This guide covers 5 methods. Takes about 10-15 minutes. You need basic file access skills.

Prerequisites

Before touching any files, make sure you have these ready:

  • FTP client like FileZilla 3.67.0 or cPanel File Manager access
  • WordPress admin dashboard (if your site still loads)
  • Text editor such as Notepad++ or VS Code
  • Hosting account login credentials
  • Full site backup completed
  • PHP version 7.4 or later installed

No backup? Do that first. Seriously.

You can check your WordPress error log to confirm the exact error before making changes.

Step One: How Do You Check Your Current PHP Memory Limit?

Go to your WordPress Dashboard. Navigate to Tools > Site Health > Info > Server.

Find the PHP memory limit value there.

Default WordPress allocation sits at 64MB or 256MB depending on your hosting provider. Values below 128MB cause problems on sites with multiple plugins.

Action

  1. WordPress Dashboard > Tools > Site Health > Info
  2. Expand the Server section
  3. Locate PHP memory limit field
  4. Write down the current value (displays in MB format)

Purpose

This confirms whether memory limit is actually your problem before you start editing configuration files.

If you see 256MB or higher and still get errors, something else is wrong. Probably a plugin with a memory leak.

Step Two: How Do You Increase Memory Limit via wp-config.php?

YouTube player

Access your WordPress root directory through FTP or cPanel. Open the wp-config.php file.

Add one line of code before the comment that says stop editing. Save and upload. Changes work immediately without server restart.

Action

  1. Connect via FTP to your publichtml folder
  2. Download and open wp-config.php
  3. Find this line: / That's all, stop editing! Happy blogging. /
  4. Add this code right above it: define( 'WPMEMORYLIMIT', '256M' );
  5. Save the file and upload it back to server

Purpose

WordPress reads this configuration file on every page load. It allocates the memory you specify.

This fixes the WordPress memory exhausted error on most hosting setups.

Still seeing problems? Your host might have server-level limits that override this setting.

Step Three: How Do You Modify Memory Limit in php.ini File?

Not sure where php.ini is located in WordPress? Check your server root directory first.

Some hosts hide it. Some let you create your own. Find the memorylimit directive and change it.

Action

  1. Connect via FTP and look for php.ini in root directory
  2. If missing, create a new file named php.ini
  3. Add or modify: memorylimit = 256M
  4. Save and upload the file
  5. Some hosts require Apache restart via cPanel

Purpose

Server-level PHP configuration overrides WordPress settings on many hosting environments.

This method works when wp-config.php changes do nothing. Shared hosting often needs this approach.

If your host uses cPanel, check the MultiPHP INI Editor instead. Faster than manual file editing.

The allowed memory size exhausted message should disappear after this change takes effect.

Step Four: How Do You Set Memory Limit Through .htaccess File?

YouTube player

Access your .htaccess file in the WordPress root folder via FTP or File Manager.

Add the PHP value directive after existing WordPress rules. This only works on Apache servers with modphp enabled.

Action

  1. Navigate to publichtml via FTP
  2. Open .htaccess file
  3. Find the line: # END WordPress
  1. Add below it: phpvalue memorylimit 256M
  2. Save, upload, clear browser cache

Purpose

Apache servers read .htaccess directives before processing PHP requests.

If this triggers a 500 internal server error, your server does not support modphp. Remove the line and use the php.ini method instead.

Step Five: How Do You Identify Plugins Causing Memory Issues?

Sometimes the problem is not your memory limit. A badly coded plugin creates a memory leak that no amount of RAM can fix.

You need to isolate the culprit through systematic testing.

Action

  1. Connect via FTP to wp-content folder
  2. Rename plugins folder to pluginsold
  3. Load your site in browser
  4. If it works, rename folder back to plugins
  5. Rename individual plugin folders one by one until you find the problem

Purpose

Renaming the plugins folder deactivates all plugins without touching your database or site files.

This method also helps diagnose errors when updating plugins and other plugin conflicts.

Verification

After making changes, confirm everything worked:

  • Return to Tools > Site Health > Info > Server
  • PHP memory limit should display your new value (256M or higher)
  • Test the action that triggered the error (plugin install, media upload)
  • No fatal error message appears
  • White screen issue resolved

If Site Health still shows the old value, your hosting provider has server-level restrictions. Contact their support.

Troubleshooting

Memory limit unchanged after wp-config.php edit

Some shared hosts cap memory regardless of configuration. Contact your hosting support for server-level memory allocation increase.

.htaccess changes cause 500 error

Remove the phpvalue line immediately. Your server does not support modphp. Use php.ini or wp-config.php method.

Error persists after increasing to 256M

Try 512M. If still failing, you have a plugin or theme with a memory leak. Run the plugin rename test from Step Five.

Check also for WordPress theme errors by switching to Twenty Twenty-Five temporarily.

No FTP or File Manager access

Contact hosting provider directly. Request PHP memory limit increase via server configuration or ask for file access credentials.

Site shows blank white page

Enable debug mode by adding define( 'WPDEBUG', true ); to wp-config.php.

This displays the actual error message. You might discover a syntax error or database error instead of memory issues.

Error appears only when uploading images

Large image files consume massive memory during processing. Compress images before upload or check for media library errors.

Sometimes the real issue is WordPress not being able to upload images due to permission problems.

Alternative Methods

Method A: wp-config.php (Primary)

  • Time: 3-5 minutes
  • Access required: FTP or cPanel
  • Success rate: High on most hosts

Method B: Contact Hosting Provider

  • Time: 1-24 hours (support response)
  • Access required: Hosting account only
  • Best for: Shared hosting with strict limits

Choose Method A when you have file access. Choose Method B when file changes produce no effect.

VPS and cloud hosting users can usually set unlimited memory. Shared hosting has hard caps.

Causes of WordPress Memory Exhaustion

Understanding why this happens prevents future occurrences:

  • Poorly coded plugins running infinite loops
  • High-resolution images without compression
  • Page builders loading multiple modules at once
  • Outdated PHP version below 7.4
  • Shared hosting resource limitations
  • MySQL database queries loading excessive data
  • Cache plugins with misconfigured object caching
  • Themes lacking memory optimization
  • 30+ active plugins running simultaneously

Running too many plugins also causes timeout errors and slow backend performance.

Recommended Memory Limits by Site Type

Not every site needs 512MB. Here is what actually works:

  • Basic blog (5-10 plugins): 128M
  • Business site (15-20 plugins): 256M
  • WooCommerce store: 512M
  • Membership site with LMS: 512M-1024M
  • High-traffic multisite: 1024M or higher

WooCommerce sites need more memory because product pages, cart calculations, and checkout processes run heavy PHP scripts.

Related Processes

If you fixed the memory error, these guides help with related issues:

Memory issues often come with other symptoms. Check the WordPress HTTP error guide if uploads still fail after increasing limits.

FAQ on WordPress Fatal Error: Out Of Memory

What does “allowed memory size exhausted” mean in WordPress?

This PHP fatal error means your site tried to use more server memory than allocated. WordPress scripts, plugins, or theme functions exceeded the PHP memory limit set by your hosting provider.

How much PHP memory does WordPress need?

Basic sites need 128MB minimum. Business sites with 15-20 plugins require 256MB. WooCommerce stores and membership sites work best with 512MB or higher.

Can I set unlimited memory in WordPress?

Technically yes, using -1 as the value. But shared hosting providers block this. VPS and dedicated servers allow higher limits. Setting unlimited memory also masks underlying plugin problems.

Why does the memory error keep coming back?

A plugin or theme has a memory leak. Increasing the limit only delays the crash. Identify the culprit by deactivating plugins one by one. Check for WordPress fatal errors in your debug log.

Does upgrading PHP version help with memory errors?

Yes. PHP 8.x uses memory more efficiently than PHP 7.x or older versions. Upgrading often reduces memory consumption by 20-30% without changing any settings. Check compatibility first.

Will increasing memory slow down my website?

No. Allocating more PHP memory does not affect page speed. Your site only uses what it needs. Unused allocated memory stays available for other server processes.

What if my hosting provider won’t increase the memory limit?

Switch to better hosting. Managed WordPress hosts like Kinsta, SiteGround, or Cloudways offer higher default limits. Budget shared hosting caps memory to protect other sites on the server.

Can a theme cause memory exhaustion errors?

Absolutely. Bloated themes with excessive features consume huge memory. Page builders like Elementor need 256MB minimum. Switch to a lightweight theme like GeneratePress or Astra to test.

How do I check which plugin uses the most memory?

Install Query Monitor plugin. It displays memory usage per plugin and theme. Look for anything consuming over 50MB. Deactivate or replace resource-heavy plugins causing problems.

Is memory exhausted error the same as server timeout?

No. Memory errors stop scripts immediately when RAM runs out. Timeout errors occur when scripts run too long. Both can cause the same white screen result but need different fixes.

Conclusion

Fixing WordPress Fatal Error: Out of Memory comes down to increasing your PHP memory allocation or finding the resource-heavy plugin causing the leak.

Start with wp-config.php edits. Move to php.ini if that fails. Contact your hosting provider when server-level caps block your changes.

Shared hosting has limits. VPS and managed WordPress hosting give you more control over server memory settings.

Remember to check WordPress Site Health after making changes. Verify your new memory limit appears in the Server section.

Still seeing errors? The problem might be deeper. Look into failed to open stream errors or database connection issues that sometimes appear alongside memory problems.

Keep your site backed up. Test changes on staging first when possible.

Author

Bogdan Sandu specializes in web and graphic design, focusing on creating user-friendly websites, innovative UI kits, and unique fonts.Many of his resources are available on various design marketplaces. Over the years, he's worked with a range of clients and contributed to design publications like Designmodo, WebDesignerDepot, and Speckyboy, Slider Revolution among others.