How to Fix WordPress Memory Exhausted Error – Increase PHP Memory

This is bound to happen to most of us and chances are that you are reading this article because the same thing has happened to you already.

The thing to remember is that you do not have to mash up that panic button and you need to remember the fact that WordPress comes with advanced functionality which means that you can easily resolve this issue, once and for all.

It so happens that your website and WordPress in particular sets your memory size by default and you need to change this, so as to resolve this issue at the earliest.

You need to remember that your website is not just down, but it sends a message to prospective customers that you cannot be depended on to offer competitive solutions.

In other words, it is in your interest to resolve this issue at the earliest and WordPress makes it easy. So, if you were wondering “How to Fix WordPress Memory Exhausted Error – Increase PHP Memory”, then you have come to the right place – just read on.

Remember that some of the steps may involve changing the theme core files which is why it is vital that you do a complete backup before you get started.

WordPress Memory Exhausted Error

What is the WordPress memory exhausted error?

Primarily, when you set up a WordPress website, then the WordPress server allocates your website with default memory space.

And when you run out of the allocated memory space, then you usually get a memory exhausted error along these lines, which is posted below for your reference –

“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”.

The good news is that the issue is solvable and all you need to do is to follow the steps listed below to resolve the same at the earliest; for the longer your website is down, you would end up losing more prospective leads.

Just follow the simple directions and you should be able to enhance the PHP memory of your website successfully.

Steps to Fix WordPress Memory Exhausted Error

1. Wp-config file:

The first thing that you need to do is to access the root directory of your website. Just head over to your web hosting control panel and click on the FTP client or file manager.

Now, head over to the root directory of your website and you should be able to locate the same along with the wp-content, -includes etc. Now, all you have to do is to download the wp-config file, and save it on your system.

Open the saved file using a text editor or notepad, edit the file to include this code.

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

Once you have finished editing the file, save it and upload it to your root using the FTP client and the rest should be fine. You have successfully managed to increase the memory size of your website.

Related Post: How to Fix the 500 Internal Server Error on Your WordPress Website

2. cPanel:

The fact remains that this error is more or less inevitable as WordPress sets the memory size by default. So, if you are running a huge website, then chances are that you are bound to come across this error sooner than later.

If after editing the wp-config file, you are still getting the same “memory exhausted’” error then it could be that your hosting provider is preventing you from enhancing your memory space successfully.

In that case, this is what you need to do – you need to head over to your cPanel, and click on software and under which, you should be able to locate the “PHP section”.

Once you have done so, click on “switch to PHP options”, and you should be able to see various options including one for increasing the memory size of your website.

From the drop down menu, see which PHP memory size you want your website to be based on, and set to the same. Once you have done successfully, wait for a few seconds for the information to be updated.

Now, you have successfully enhanced your memory size of the website using cPanel.

3. Plugins:

Plugins, especially external ones can cause your website to develop various problems manly on account of the fact that they often use a lot of memory space.

When that happens, it is important that you first try to locate the plugin which is exhausting your memory and deactivate the same. What’s more, it should also help you increase the performance of your website as well.

The first thing that you need to do is to download and install a performance plugin as that should provide a good idea of how many plugins are running in the background and how much of the limited memory space they are exhausting at the moment.

Just head over to your hosting account, and use an FTP client to access your root. You should be able to access the various plugins that are being utilized by your website.

Now, change the name of the plugins folder and see if it helps to resolve the memory issue. If it does, then change it back and now, change the names of each plugin one by one.

Doing so, you should be able to deactivate each plugin, and check and see if you are able to access the main admin area as well.

And once you have the confirmation that a certain plugin is using up more space than required, then all you have to do is to deactivate the plugin in question.

With the steps listed here, you should be able to enhance the PHP memory size and in the process, ensure that you are able to enhance the memory size of your website.

Additionally, you can also tweak with the PHP.ini file, info.php file to get your website to increase its PHP memory.

The point being that when it comes to memory exhausted error, you can easily resolve the issue as WordPress comes with advanced functionality that would enable you to do just that.

You do not have to panic unnecessarily, and can easily resolve this in a matter of minutes by following the steps listed above.

About Sonnal S Sinha

Sonnal S SinhaSonnal S Sinha is a passionate writer as well as WordPress and WooCommerce rockstar who loves to share insights on various topics through his engaging blog posts. He runs a successful website design and digital marketing company. With 15+ years of experience in WordPress theme development, he strives to inform and inspire readers with his thought-provoking content. He helps thousands of small and medium businesses and startups create a unique online presence. Follow Sonnal S Sinha for your regular dose of knowledge and inspiration.

Do check out our free WordPress themes and WordPress themes bundle