Fix: WordPress Memory Exhausted Error-Increase WordPress Memory Limit

Increase Wordpress Memory limit
Increase Wordpress Memory limit

Are you seeing an allowed memory error notice on our website? Generally, when you install woo-commerce or other plugins this error will show you. This is one of the most common error in WordPress. This error you can fix easily by increase memory limit in WordPress. In this article, I will show you how to increase the WordPress memory limit.

What is WordPress Memory Exhausted Error?

PHP is a server-side programming language and WordPress made in PHP. Every WordPress website needs WordPress hosting for the function work properly behind the website.

Web Servers are like a computer and they need memory to work efficiently with multiple application at the same time in the same server. Server admin allocates a specific memory size for every server application through the PHP. WordPress allowed memory size of 32M and recommended PHP memory limit is 64M.

But when you install plugins it might more memory for executing the application for the reason WordPress shows the error notice and recommend increase PHP memory. WordPress Fatal error message looks like

“Fatal error: Allowed memory size of 23556632 bytes exhausted (tried to allocate 3349917 bytes) in /home/xxxxx/public_html/wp-includes/plugin.php on line xxx”

Now let’s get to increase the memory limit.

Increase PHP memory in WordPress through edit files:

To increase memory limit first you need to edit the wp-config.php file in your WordPress site from your hosting panel and you will find the file in the website’s root folder. Go to your hosting panel using FTP or hosting file manager and edit it.

Next, you need to paste this code in the wp-config.php file before the sentence ‘That’s all, stop editing! Happy blogging.’

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

This code indicates WordPress to increase the memory limit to 256M.

increase php memory limit via wp-config.php file
increase php memory limit via wp-config.php file

When you have done your edit, click the save button to save your changes.

You can now visit your website and see the memory error notice should pass now.

Increase WordPress memory limit through PHP.ini:

If you find defining the memory limit through the wp-config.php file is not working you might set again memory limit through PHP configuration file called PHP.ini file.

To set memory limit through PHP.ini you need to go to your hosting panel and search “MultiPHP INI Editor”.

increase php memory limit via php.ini editor
PHP.ini editor

Normally you are in the basic mode of edit PHP.ini editor, next you need to select the location (basically your domain). Scroll down and you will find memory_limit. Set memory limit to 256 and then save changes.

increase php memory limit via php.ini editor
Select your Location (Domain)

You can edit PHP.ini with editor mode. Select the location and paste the code or edit existing limit to 256.

memory_limit = 128M ;

Once you are done click to save.

Increase PHP memory limit through .htaccess:

You can increase the WordPress memory limit via the .htaccess file. Go to your website’s root folder from the file manager and edit the .htaccess file.

increase php memory limit via .htaccess file
increase php memory limit via .htaccess file

Copy and paste the code into the .htaccess file and save your changes.

php_value memory_limit 128M


If these solution does not work for you, no worry contact your hosting provider and ask them to increase website PHP memory limit manually. Sometimes many shared hosting provider not allowed to increase the memory limit for the WordPress site. So you have to upgrade to WordPress hosting to avoid the error.


Please enter your comment!
Please enter your name here