You are currently viewing How to Fix the WordPress memory exhausted Error

How to Fix the WordPress memory exhausted Error

WordPress memory exhausted error is one of the most common problems which WP users and developers encounter with. In the core, WP “eats” all available memory on the server and stops running. Stay with me because in this short but very fruitful post you will get a tiny jam which is essential for the life of your website.

There are a few advantages and drawbacks to using an open-source platform like WordPress. If you don’t know what WordPress is, you must live under a rock. Well move that stone and read our article First step in WordPress. WordPress is very flexible and scalable, however, sometimes it also requires you to be comfortable with some amount of technical skills. Don’t worry, there is nothing to be scared of. 

An Introduction to WordPress memory exhausted Error

As I mentioned before this is one of the common WP errors. Another name for this problem is “PHP memory limit error”. Often looks like this:

WordPress memory exhausted Error
Critical error from the website when runs out of memory

This bad situation can occur in many different operations during creating a website or running too. However, specific types of action on your website could give that error, such as: 

  • Installing and activating a new theme or plugin,
  • Activating more plugins at once,
  • Uploading images or videos.

Don’t worry if you have run into this error during your work with WordPress. The reason behind the WordPress memory exhausted error is very simple – let’s talk about that from my experience. Before that, be sure to see the error log. Here is mine.

Error log

How did it happen?

WordPress for functioning needs some amount of memory which is provided by server aka. hosting provider. PHP is the WP core and uses server memory. Usually, I’m comparing this with a hamster in the wheel. In the beginning when the hamster is little he can fit in the wheel and run as fast as he can. With time he grows, but the wheel has the same size. One day the hamster can’t run because there isn’t enough room for him. The same staff goes with your website, it can function while it has enough space (memory). You ended up with a critical error like in the screenshot above.

If you prefer more video format check the tutorial on my YT Channel – WordPress memory exhausted Error.

How to check your PHP memory limit

If you are running at least WordPress 5.2 or above you can check the current PHP memory limit with the Site Health tool. From your WP dashboard, go to “Tools” — “Site Health” then scroll down to the “Server” section. Under the PHP memory limit, you can see the amount of available memory. See the image below.

Check PHP memory limit, WordPress memory exhausted Error
Check PHP memory limit

How to resolve WordPress memory exhausted Error

If the amount is low, say 64M you need to increase the amount of memory allocated to your website. There are two different methods how to deal with WordPress memory exhausted Error:

  • Do it manually editing the “wp-config.php” file,
  • Upgrade your hosting plan.

How to edit the “wp-config.php” file?

Make an effort with the first solution. You can do that using FTP (file transfer protocol), but I don’t like to bother myself with FTP clients’ unnecessary passwords and so on. There is another way to escape FTP and set up WordPress without it. Who needs an FTP if you have access to cPanel, right? Besides that, some hosts may not let you access your site through an FTP client. 

Login into cPanel then goes to the “File Manager” open “public_html” folder. Scroll down to the “wp-config.php” file, click RMB on it, and choose edit. Scroll down under the infos about the database, user, and password, and find this line:

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

Be aware that the number may be different in your case, as it represents your site’s current memory limit. In most cases, you may not find this line at all. Then, find the line “That’s all, stop editing! Happy blogging.”, and paste the function from above just before that line. Don’t forget to save the changes.

Edit wp-config.php , WordPress memory exhausted Error
Edit “wp-config.php” file

If you still encounter the error, edit the file again and increase the memory limit further. However, if that didn’t work for you there is a chance you may have reached the maximum limit allowed by your hosting provider. In this case, you need to contact them and upgrade your hosting plan or change the hosting provider.

Conclusion

Now you are a badass WordPress website owner or developer. This was my tiny jam for you. Tell me how much do you like this article. Does it was helpful for you? Much more is coming in time. By that follow me on Twitter and YouTube to see more helpful tips and tutorials.

Nikola Nikolić

I'm more than 6 years in love with WordPress. I'm designing and creating websites using a vast number of Page builders like (Gutenberg, Elementor, Themify). I like to code from scratch with HTML, CSS, and JS. Now I'm learning custom WordPress themes. Additionally, I'm enjoying spending my free time reading epic fantasy books and modeling in Blender open-source software.