How to Fix “Fatal Error: Allowed Memory Size Exhausted” on your WordPress site

If you’ve been using WordPress for a while now, you know that one of the most common errors you’ll see is the “Fatal Error: Allowed Memory Size Exhausted” message. This is super alarming because instead of seeing your gorgeous site, you see this ugly white page with some confusing text on the screen. Never fear, the Divi Engine team is here to bail you out. We are going to talk about why you might see the “Fatal Error: Allowed Memory Size Exhausted” error, but if you want to skip to the solution, click the button below.

What does “Fatal Error: Allowed Memory Size Exhausted” mean?

So let’s look at an exact example of this issue below and talk about what it means.
WordPress Fatal Error: Allocated Memory Size Exhausted

The big clue here is in the message itself, it says that the “Allowed memory size of 33554432 bytes exhausted”. Now for some of us that are newer might think “But hey, my computer has a ton of memory”, and this is a common misunderstanding and why this message can be confusing. What this message refers to is the memory that your web server with your hosting provider has provided for your site to run. This is often set to a very low number like 32 megabytes which can cause issues when doing things like uploading images or installing a new theme. When the PHP which powers WordPress runs into that memory limit on the server, it triggers this fatal error causing widespread panic, but don’t stress as there is a very easy fix to the issue.

NOTE: WordPress is written in PHP, which is a server-side programming language. The better hosting services you pay for, the better your sites will generally perform. Poor memory performance can often be tied to cheaper shared hosting.

How to check your PHP Memory Limit

The first step in avoiding the “Fatal Error: Allowed Memory Size Exhausted” issue is to check what your current PHP Limit is. If you are running an updated WordPress install, this is very easy to do.

Just head over to “Tools” > “Site Health” > “Info”

Once there scroll down to the “Server” section and there you will see the “PHP memory limit”. If this number is 64 or less, you will definitely need to increase the “PHP memory limit”.

WordPress Site Health

Solution: “Fatal Error: Allowed Memory Size Exhausted”

To fix this, all we need to do is access the filesystem for our WordPress install using your favorite FTP client and edit the wp-config.php file. This file can be found at the root of your WordPress install.

NOTE: To learn more about editing the wp-config.php file check out this article.

Once you’ve located the file and opened it in a text editor you will either need to modify a line of code that defines the amount of memory allocated to the PHP or add that line in.

define( 'WP_MEMORY_LIMIT', '256M' );

If you see the above line in the wp-config.php files, make sure that it is set to at least “256M”.

If you don’t see the line in this file, you’ll need to add it before the line that reads “/* That’s all, stop editing! Happy publishing. */

WordPress wp-config.php file

Make sure to save the file and that is it! Your WordPress install will now be much happier that it has more memory at its disposal.

NOTE: In some instances, this solution may not work for and this is usually because your hosting provider has disabled this feature. If this is the case, contact the support team at your hosting provider and ask them to increase your PHP memory limit.

Conclusion

Hopefully, this quick post solves your “Fatal Error: Allowed Memory Size Exhausted” issue and sends you on your way to build an awesome site. Definitely check out our blog for more articles just like this one designed to help you build the best sites possible.

1 Comment

  1. Comment *

    Es la primera página que deseo crear y al revisar los pasos indicados, ya esta con 768M en el límite de PHP, entonces a qué se debe que no puedo editar?

Submit a Comment

Explore more from Divi Engine