How to Increase Allowed Memory Size Limit in WordPress

The WordPress memory limit error is a common issue that appears when you try to upload an image, activate a new plugin, and sometimes with new themes installations. In general, your web hosting provider configures the PHP memory limit by default, but you can edit that limit later to correct the issue.

Please note that sometimes you’re not allowed to edit the WordPress PHP memory limit if your server is poorly configured. For now, let’s learn how to increase the allowed memory size in WordPress in easy steps, and without complicated things.

The message will look like this:

Fatal Error: Allowed Memory Size Of 33554432 Bytes Exhausted

In general, the error looks like the above line with other detailed information about your PHP files, and the memory limits.

How to increase the memory limit in WordPress

To fix the problem and increase the PHP memory size, you have to do one of the following solutions:

1. Using the wp-confing.php file

Open your File editor and locate the file wp-config.php in the root directory, then add the following code:

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

If you still have the error, change 64M with 128M.

2. Using the htaccess file

This another method to increase the WordPress PHP memory limit, add this code to your htaccess file:

php_value memory_limit 64M

Or simply, log in to your cPanel account, then click ”File Manager”, or ”Legacy File Manager”, check both the Root folder icon, and the show hidden files, and then click Go.

how to increase allowed memory size in WordPress

Now, scroll down until you find the “wp-config.php” file as next:

wordpress php memory limit

Click the file link and then you will get a new window with options, select ”edit” and add the code in that file. Don’t forget to save the file before closing the window.

There is another solution with php.ini file, but it’s only available for PHP version 5 and higher. So, make sure that you have a new PHP version, then login to your cPanel account, and open the file editor, or use an FTP client such as Filezilla.

Next, locate the file php.ini and click the ”edit” icon at the top of your window. We simply want to edit that file and change the default memory size there. So, use any text editor and when you have the file content click on (Ctrl+F) to find this line:
memory_limit = 32M ….

Related:  Can't install WordPress plugins or themes? fix the problem now

Now, change that initial value from 32MB to 64MB if you want, and make sure to save the file before closing the window, or, you will still have the default memory size.

If you are using more PHP resources and you can’t add the value that you want, then, you’re using the maximum memory that the server was configured for. In this case, you have to contact your hosting provider and ask if they can set the maximum PHP memory for your website at a higher level.

If you still get the error and want more than the actual memory, then you should have your own VPS OR A dedicated server and manage your resources as you want. I recommend Liquid Web that offers advanced dedicated server hosting. The service comes with a powerful PHP memory and RAM that can work with any advanced website, even, if you have high traffic.

These are the two easiest methods to increase the WordPress memory limit without risks, just follow the above steps, and it’s done.

If for any reason, you still have the error message, then you should contact your hosting provider, tell them about the problem with a screenshot. That will help to resolve the problem in the server.

Avatar for Fathi Arfaoui
About Fathi Arfaoui

Fathi Arfaoui is a Physicist, Blogger and the founder of Trustiko.com. He shares Business, WordPress and Blogging tips to build a better blog and succeed online.

Disclosure: The recommendations on this page are my own based on my tests and analysis. We may earn a small commission from web hosts and other partners if you use my referral link to make a purchase. That’s what helps us to maintain the site and add fresh content, Thanks for your support.

Leave a Comment