How to Fix WordPress Memory Exhausted Error by Increasing PHP Memory

By October 2, 2018 June 18th, 2019 WordPress

WordPress is awesome, but there are times that the server can’t provide enough resources in order for WP to run properly which causes those fun memory size exhausted errors. What is good about WordPress is that it is very flexible and it’s pretty easy to increase your allowed memory… if the host allows it.

In this article, we will be talking about what the memory size exhausted error is and how we can fix it.

What is The WordPress Memory Exhausted Error?

When having trouble with the memory exhausted error in WordPress, the display message is the following:

Fatal error: Allowed memory size of 123456789 bytes exhausted (tried to allocate 987654322 bytes) in /home4/xxx/public_html/wp-includes/plugin.php on line xxx

Fatal error display message

WordPress is built using PHP. PHP is a server-side programming language wherein a fatal error means that your website ran into an issue that stopped it from executing a script. When WordPress tries to execute a script, the memory exhausted error occurs since it doesn’t have enough memory to execute the action.

In addition, in order to function, a website needs a WordPress hosting server. Web servers need huge memory in order to run multiple applications simultaneously. There is a specific memory size allocated to different applications. When the site requires greater memory than what is allocated, the memory size exhausted error shows.

The PHP memory limit of a site is automatically increased if it is not greater than 64MB which is not huge enough.

Now that you already understand what the error is, let’s take a look at how can you fix this error.

Looking to take your WordPress skills to the next level and learn how to build & monetise authority sites?

The guys over at Authority Hacker released a free training webinar based on their epic Authority Site System course. The webinar covers everything from keyword research to outsourcing content, and getting links so you can actually rank your site in Google (it's how you found this very page).

While this free training focuses on affiliate marketing as the monetisation method (mainly because it's the most passive strategy around at the moment), you can apply these strategies to almost any site... it's pretty neat!

Grab the free training webinar here!

Increase PHP Memory Limit in WordPress

The first things that you have to do in order to increase the PHP memory limit of your site are to edit the wp-config.php file of your WordPress site. The wp-config.php file is located at the root folder of your WordPress site, thus you have to use your web hosting control panel’s FTP client or file manager.
After editing the wp-config.php file, paste this before the ‘That’s all, stop editing! Happy blogging.’ line in order to increase the PHP memory limit to 256MB.

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

After doing so, save the changes you have made and upload the wp-config.php of your WordPress site back to the server.

Finally, check it out if the memory exhausted error is no longer in your site. In case that the error is still in your site, it means that you are not allowed to increase your PHP memory limit by your web hosting service provider.

Note: Try checking the codes, as well as the error, might be there.

MangoMatter WP Team

About MangoMatter WP Team

We live to solve WordPress issues, and help beginners on their WP journey :)