Header Ads

How to Fix WordPress Exhausted Memory Error by Increasing PHP Memory Limit?

Have you ever come across an allowed memory size exhausted error in WordPress? Well, there’s nothing much to worry about as it is one of the most commonly occurring errors in WordPress. And the good part is that it won’t take longer for a WordPress specialist to fix it.
In today’s post we would let you know how you can solve this error easily by increasing the memory limit of PHP in WordPress.

Let’s understand WordPress memory exhausted error in brief

WordPress breathes on PHP which is one of the most popular server-side languages. Every WordPress website requires a WordPress hosting server in order to run its applications.

Like any other computer, web servers also need memory to run multiple applications at the same time and efficiently as well. Similarly, the harder WordPress works on a server, the larger memory it will use on the server.

However, there is a default memory allocation rule established in WordPress which makes sure that not too much of a server’s memory is used up. This significant feature prevents crashing down of server owing to utilization of all the available server memory by broken scripts.

Furthermore, when the demand of memory by your WordPress code exceeds the default allocated one then you would very likely see this error:
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2348617 bytes) in /home4/xxx/public_html/wp-includes/plugin.php on line xxx
When server administrators allocate memory, WordPress by default takes the memory limit to 64MB. If it is less than 64MB then WordPress automatically tries to reach that limit. However, if your website is getting high traffic in the form of visitors or in the form of comments then 64MB is cannot be considered high enough.

How to increase PHP memory limit manually in WordPress?

First of all, you would need to find your WordPress site’s wp-config.php file located inside your WordPress site’s root directory by using an FTP client or a file manager in your web hosting panel.

Your PHP development specialist would use a command like:

sudo nano /var/www/html/wp-config.php

In the wp-config.php file they will search for the line that reads //** MySQL settings – You can get this information from your web host **//.

Above this line the following line has to be added:

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

This code will instruct WordPress to increase the PHP memory limit to 256MB; however, you can extend the memory limit if needed.

Once the aforementioned changes are done, your hired developer should upload back the wp-config.php file back to your server.

Now it’s your turn

After increasing the PHP memory limit manually when you visit your WordPress website, you would find that the memory exhausted error has disappeared.

How your experience was while you came across WordPress exhausted memory error? We would love to hear from you; please leave your comments below.
Powered by Blogger.