The WordPress memory limit error is a common issue appears when you try to upload an image, activate a new plugin, and sometimes with new themes installations. In general, your web hosting provider configure 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.
You can also read: How to reduce WordPress database size
The message will looks like:
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:
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
If you don’t have any idea about how to open your Blog files, take a look at how edit file permissions,where you can learn how to open your blog files.
Or simply, login 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.
Now, scroll down until you find wp-config.php file as below:
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 after before closing the window.
There is another solution with php.ini file, but it’s only available for the PHP version 5 and higher. So, make sure that you have a new PHP version, then login to you 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 ….
Now, change that initial value 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 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 an 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.
Fathi Arfaoui: A Physicist, founder and owner of Trustiko.com. He shares Business, WordPress, Web Safety, and Blogging tips to build better websites and blogs. Thus, you will succeed online with the right marketing strategies and recommendations. Of course, you’ll find much more topics.