Are you seeing an allowed memory size exhausted error in WordPress? This is one of the most common WordPress errors, and you can easily fix it by increasing the php memory limit in WordPress. In this article, we will show you how to fix WordPress memory exhausted error by increasing PHP memory.
What is WordPress Memory Exhausted Error?
WordPress is written in PHP, which is a server-side programming language. Every website needs a WordPress hosting server for it to function properly.
Web servers are just like any other computer. They need memory to efficiently run multiple applications at the same time. Server administrators allocate specific memory size to different applications including PHP.
When your WordPress code requires more memory than the default allocated memory, you get to 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
By default, WordPress automatically tries to increase PHP memory limit if it is less than 64MB. However, 64MB is often not high enough.
Having said that, let’s see how to easily increase PHP memory limit in WordPress to avoid memory exhausted error.
Increase PHP Memory Limit in WordPress
First you need to edit the wp-config.php file on your WordPress site. It is located in your WordPress site’s root folder, and you will need to use an FTP client or file manager in your web hosting control panel.
Next, you need to paste this code in wp-config.php file just before the line that says ‘That’s all, stop editing! Happy blogging.’
define( 'WP_MEMORY_LIMIT', '256M' );
This code tells WordPress to increase the PHP memory limit to 256MB.
Once you are done, you need to save your changes and upload your wp-config.php file back to your server.
You can now visit your WordPress site and memory exhausted error should disappear now.
If you are new to WordPress, then take a look at our beginners guide on how to copy and paste code from the web.
We also have a step by step guide on how to find and edit wp-config.php file.
Note: If this solution does not work for you, then this means your web hosting service provider does not allow WordPress to increase PHP memory limit. You will need to ask your web hosting provider to increase your PHP memory limit manually.
That’s all we hope this article helped you solve WordPress memory exhausted error by increasing PHP memory limit. You may also want to see our step-by-step beginner’s guide to troubleshooting WordPress errors.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
I’m new in WordPress and I’m trying to figure out, for a couple of days, why suddenly I get an error 500 and can’t save my edits. This helped solve my problem. Thank you so much!
Glad our guide could help
Thanks for this – it fixed my problem.
Glad our guide was helpful
Helpful, Thank you so much
You’re welcome
This worked perfectly for me. Thanks
You’re welcome
can I increase the memory to 512?
You can certainly try to see if that fixes the error for you.
Thanks it helped me a lot
Glad our guide was helpful
This solution is not working for me, my website is hosted at AWS server and I have all the access, I have tried to set memory_limit in php.ini, wp-config and .htaccess. but still getting issue when accessing backend pages.
You would want to reach out to the support for your hosting for what other options you have available with AWS
Thanks a lot….
A quick and easy fix!!
You’re welcome, glad our guide was helpful
You just saved me from heart attack…..
Glad our guide could help
Thaaaanks, you save my day!
You’re welcome
Thanks so much! Was so worried when I had this fatal error, but this fix is just a piece of cake!
Glad our guide was helpful
Thank you for this post…
Very Helpful
You’re welcome
Thanks you so much for your help
You’re welcome
This is not working for me.
If our recommendations are not working, you would want to reach out to your hosting provider and they should be able to assist
this still works after few years,, Great thank you… works for me as well
Glad our recommendation was helpful
Great tip! Thank you very much!
You’re welcome
Thank you so so much! can’t really explain how helpful this was
Glad our guide was helpful
Thank you so much.
Solved my issue
Glad our guide was helpful
Very thanks, fixed
Glad our guide was helpful
Hi, I had the memory exhausted message and I increased the wp memory limit to 12mb and it worked. Then a few days later I had the same error, so I had to increase the wp memory limit to 256mb and the message kept showing. I am currently on 1024mb, which seems excessive for a small website of 4 pages and a blog post of 15,000 words. Any suggestions how to resolve the issue or what might be causing it?
You would want to reach out to your hosting provider and they can normally assist in finding the root of the issue for your specific site.
thank you so much.
You’re welcome
thanks so much!
You’re welcome
Thank you very much. You solved my problem.
Glad our article was able to assist
My website has been hacked. Which is showing the homepage blank. In which the script has been injected, as well as the entire WordPress files. Database file is also affected.
Please suggest any solution for this. What do i have to do next steps.
For fixing a hacked site, you would want to follow our guide below:
https://www.wpbeginner.com/beginners-guide/beginners-step-step-guide-fixing-hacked-wordpress-site/
wow its working… thanks word press …..!
Glad our troubleshooting guide could help
Ran into this exact constraint today, thank you for the concise and helpful article
You’re welcome, glad our guide could be helpful
wow.. this works in 2020 as well. Thanks a lot.
Correct, you’re welcome glad the guide could help
Hey. My website is doing well. but whenever i tried to edit any post my server memory and I/O exhaust
If you reach out to your hosting provider they should be able to help prevent this error going forward
It worked!! thanks a lot, I should say that if you are using control panel you can access and edit the file config,php within the same platform no need to dowload the file for editing.
It depends on the hosting provider as not all have a file manager that they offer but thanks for sharing
Thanks. That was great tip that saved me.
You’re welcome, glad our guide could be helpful
Great, Thank you very much…
You’re welcome
Thank you so much. This solved my problem.
You’re welcome, glad we could be helpful
Thanks Alot, worked for me
You’re welcome, glad our guide worked
thanks for information.
solved my problem.
You’re welcome, glad our guide could help
Thanks for this article, we’ve been having this problem too.
Which setting takes priority?
In WHM (MultiPHP INI Editor), memory_limit is set to 32M.
In wp-config.php WP_MEMORY_LIMIT is set to 96M.
Normally wp-config but it would depend on your specific hosting and the settings.
A lot of thanks!
You’re welcome
but what exactly is this wordpress memory limit, like how much amount of RAM should wp use on the server? can anyone please share about what this thing is?
thanks
The memory limit tells WordPress how large requests/files can be for individual tasks, this is not for your site’s RAM and your RAM usage would be determined by what is on your site.
thanks you wpbeginner
you solve my problom
but i have vps , can i increes more memory limit
please reply
You would need to reach out to your hosting provider for what is available to you
Thanks wpbeginner
You’re welcome
Thanks for the post. It really worked out for me for my problem which was a big head ache for last 5days. Thanks a lot.
You’re welcome, glad we could help solve the issue
Thanks wpbeginner for this article, i have solved my problem with the help of this article
You’re welcome, glad our guide could be helpful
Thanks.. That worked like a charm
Glad our article could help
Thank you so much. That worked great for me!
Glad our recommendations could help
It works! Thank You.
Glad our article could help
There needs to be a way to figure out these memory issues without taking the entire site offline or risking breaking the configuration by disabling essential components. Furthermore, the errors are occurring even when the memory limit is set to the maximum physical memory on the server (32GB) and while they are occurring there is no actual spike in memory usage (system utilities are reporting no increase in actual physical memory use.
You could create a staging site or download your site to a local version: https://www.wpbeginner.com/wp-tutorials/how-to-move-live-wordpress-site-to-local-server/
You could also reach out to your hosting provider to see if they have any errors on their end that they can see.
Useless when the issue does not depend on actual required memory – in my case it keeps giving the error for random plugins no matter how much memory I specify (up to 32GB). Would be nice to know an actual troubleshooting method to see what is using the memory.
For the steps involved in troubleshooting, you would want to follow our article here:
https://www.wpbeginner.com/beginners-guide/beginners-guide-to-troubleshooting-wordpress-errors-step-by-step/
Correct Solution for me…..Thank You So much wpbeginer
Glad our article could help
Solved. Many Many thanks bro
Glad our article could help
I love you ! you’re a life saver !
Glad our article could help
I wish I known that earlier. Now | lost a lot of traffic for my site.
Hopefully it is fixed now!
Hope our article helped you resolve the problem