WPBeginner

Beginner's Guide for WordPress

  • Blog
    • Beginners Guide
    • News
    • Opinion
    • Showcase
    • Themes
    • Tutorials
    • WordPress Plugins
  • Start Here
    • How to Start a Blog
    • Create a Website
    • Start an Online Store
    • Best Website Builder
    • Email Marketing
    • WordPress Hosting
    • Business Name Ideas
  • Deals
    • Bluehost Coupon
    • SiteGround Coupon
    • WP Engine Coupon
    • HostGator Coupon
    • Domain.com Coupon
    • Constant Contact
    • View All Deals »
  • Glossary
  • Videos
  • Products
X
☰
Beginner's Guide for WordPress / Start your WordPress Blog in minutes
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

WPBeginner» Blog» Tutorials» Fix: WordPress Memory Exhausted Error – Increase PHP Memory

Fix: WordPress Memory Exhausted Error – Increase PHP Memory

Last updated on January 2nd, 2020 by Editorial Staff
455 Shares
Share
Tweet
Share
Pin
Free WordPress Video Tutorials on YouTube by WPBeginner
Fix: WordPress Memory Exhausted Error – Increase PHP Memory

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.

Fix: WordPress Memory Exhausted Error – Increase 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

Memory exhausted error displayed on a WordPress site

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.

455 Shares
Share
Tweet
Share
Pin
Popular on WPBeginner Right Now!
  • How to Start Your Own Podcast (Step by Step)

    How to Start Your Own Podcast (Step by Step)

  • Google Analytics in WordPress

    How to Install Google Analytics in WordPress for Beginners

  • How to Fix the Error Establishing a Database Connection in WordPress

    How to Fix the Error Establishing a Database Connection in WordPress

  • Checklist

    Checklist: 15 Things You MUST DO Before Changing WordPress Themes

About the Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Trusted by over 1.3 million readers worldwide.

The Ultimate WordPress Toolkit

412 Comments

Leave a Reply
  1. Katerina says:
    Feb 4, 2021 at 11:03 am

    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!

    Reply
    • WPBeginner Support says:
      Feb 5, 2021 at 9:29 am

      Glad our guide could help :)

      Reply
  2. Richard Lamsdale says:
    Dec 10, 2020 at 11:30 am

    Thanks for this – it fixed my problem.

    Reply
    • WPBeginner Support says:
      Dec 11, 2020 at 9:16 am

      Glad our guide was helpful :)

      Reply
  3. Malou says:
    Nov 4, 2020 at 2:57 am

    Helpful, Thank you so much

    Reply
    • WPBeginner Support says:
      Nov 4, 2020 at 10:27 am

      You’re welcome :)

      Reply
  4. Segun says:
    Nov 3, 2020 at 9:52 am

    This worked perfectly for me. Thanks

    Reply
    • WPBeginner Support says:
      Nov 3, 2020 at 9:57 am

      You’re welcome :)

      Reply
  5. Rick Richi says:
    Oct 24, 2020 at 9:23 pm

    can I increase the memory to 512?

    Reply
    • WPBeginner Support says:
      Oct 26, 2020 at 11:30 am

      You can certainly try to see if that fixes the error for you.

      Reply
  6. Haris imran says:
    Oct 24, 2020 at 11:46 am

    Thanks it helped me a lot

    Reply
    • WPBeginner Support says:
      Oct 26, 2020 at 11:26 am

      Glad our guide was helpful :)

      Reply
  7. Arpita Hunka says:
    Sep 21, 2020 at 7:12 pm

    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.

    Reply
    • WPBeginner Support says:
      Sep 22, 2020 at 10:16 am

      You would want to reach out to the support for your hosting for what other options you have available with AWS

      Reply
  8. Anders says:
    Sep 21, 2020 at 8:02 am

    Thanks a lot…. :-)

    A quick and easy fix!!

    Reply
    • WPBeginner Support says:
      Sep 22, 2020 at 9:28 am

      You’re welcome, glad our guide was helpful :)

      Reply
  9. Faisal Arafin says:
    Sep 20, 2020 at 6:24 am

    You just saved me from heart attack…..

    Reply
    • WPBeginner Support says:
      Sep 21, 2020 at 2:54 pm

      Glad our guide could help :)

      Reply
  10. Laura says:
    Aug 27, 2020 at 11:28 am

    Thaaaanks, you save my day!

    Reply
    • WPBeginner Support says:
      Aug 28, 2020 at 11:14 am

      You’re welcome :)

      Reply
  11. Benthe Kuijpers says:
    Aug 14, 2020 at 6:28 am

    Thanks so much! Was so worried when I had this fatal error, but this fix is just a piece of cake! :-)

    Reply
    • WPBeginner Support says:
      Aug 14, 2020 at 10:15 am

      Glad our guide was helpful :)

      Reply
  12. Dileepa K says:
    Aug 8, 2020 at 3:13 pm

    Thank you for this post…
    Very Helpful

    Reply
    • WPBeginner Support says:
      Aug 10, 2020 at 1:50 pm

      You’re welcome :)

      Reply
  13. Gunvant Nakum says:
    Aug 1, 2020 at 2:54 am

    Thanks you so much for your help

    Reply
    • WPBeginner Support says:
      Aug 3, 2020 at 1:42 pm

      You’re welcome :)

      Reply
  14. Sumit Gupta says:
    Jul 24, 2020 at 1:33 pm

    This is not working for me.

    Reply
    • WPBeginner Support says:
      Jul 27, 2020 at 11:33 am

      If our recommendations are not working, you would want to reach out to your hosting provider and they should be able to assist

      Reply
  15. Ademola Kayode Abdulai says:
    Jul 24, 2020 at 9:20 am

    this still works after few years,, Great thank you… works for me as well

    Reply
    • WPBeginner Support says:
      Jul 24, 2020 at 12:59 pm

      Glad our recommendation was helpful :)

      Reply
  16. Luuk says:
    Jul 18, 2020 at 5:31 am

    Great tip! Thank you very much!

    Reply
    • WPBeginner Support says:
      Jul 22, 2020 at 1:32 pm

      You’re welcome :)

      Reply
  17. Mehedi Mahmood says:
    Jul 14, 2020 at 10:56 am

    Thank you so so much! can’t really explain how helpful this was

    Reply
    • WPBeginner Support says:
      Jul 15, 2020 at 10:24 am

      Glad our guide was helpful :)

      Reply
  18. Manthan Admane says:
    Jul 10, 2020 at 7:31 pm

    Thank you so much.
    Solved my issue :)

    Reply
    • WPBeginner Support says:
      Jul 13, 2020 at 11:33 am

      Glad our guide was helpful :)

      Reply
  19. Mevlut Demiroz says:
    Jul 4, 2020 at 4:04 pm

    Very thanks, fixed

    Reply
    • WPBeginner Support says:
      Jul 7, 2020 at 12:40 pm

      Glad our guide was helpful :)

      Reply
  20. Ivan says:
    Jul 4, 2020 at 7:33 am

    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?

    Reply
    • WPBeginner Support says:
      Jul 7, 2020 at 11:53 am

      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.

      Reply
  21. player says:
    Jun 23, 2020 at 3:35 pm

    thank you so much.

    Reply
    • WPBeginner Support says:
      Jun 24, 2020 at 8:46 am

      You’re welcome :)

      Reply
  22. Mathilda says:
    Jun 4, 2020 at 3:25 am

    thanks so much!

    Reply
    • WPBeginner Support says:
      Jun 4, 2020 at 8:46 am

      You’re welcome :)

      Reply
  23. Sone Eric says:
    May 20, 2020 at 9:20 am

    Thank you very much. You solved my problem.

    Reply
    • WPBeginner Support says:
      May 21, 2020 at 8:35 am

      Glad our article was able to assist :)

      Reply
  24. Gk Guru says:
    May 13, 2020 at 6:25 am

    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.

    Reply
    • WPBeginner Support says:
      May 13, 2020 at 9:19 am

      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/

      Reply
  25. Thanuja Dharshana says:
    May 7, 2020 at 2:52 am

    wow its working… thanks word press …..!

    Reply
    • WPBeginner Support says:
      May 8, 2020 at 9:52 am

      Glad our troubleshooting guide could help :)

      Reply
  26. Iheb Mejri says:
    May 3, 2020 at 2:23 pm

    Ran into this exact constraint today, thank you for the concise and helpful article :)

    Reply
    • WPBeginner Support says:
      May 5, 2020 at 10:23 am

      You’re welcome, glad our guide could be helpful :)

      Reply
  27. Mayur Agarwal says:
    Apr 30, 2020 at 5:16 am

    wow.. this works in 2020 as well. Thanks a lot. :)

    Reply
    • WPBeginner Support says:
      Apr 30, 2020 at 10:30 am

      Correct, you’re welcome glad the guide could help :)

      Reply
  28. Jayant singh rawat says:
    Apr 13, 2020 at 3:41 am

    Hey. My website is doing well. but whenever i tried to edit any post my server memory and I/O exhaust

    Reply
    • WPBeginner Support says:
      Apr 14, 2020 at 12:37 pm

      If you reach out to your hosting provider they should be able to help prevent this error going forward

      Reply
  29. Ricardo M says:
    Apr 3, 2020 at 1:54 pm

    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.

    Reply
    • WPBeginner Support says:
      Apr 6, 2020 at 8:50 am

      It depends on the hosting provider as not all have a file manager that they offer but thanks for sharing :)

      Reply
  30. Sudev Barar says:
    Apr 2, 2020 at 9:42 pm

    Thanks. That was great tip that saved me.

    Reply
    • WPBeginner Support says:
      Apr 3, 2020 at 9:03 am

      You’re welcome, glad our guide could be helpful :)

      Reply
  31. Rishikesh Prasad says:
    Apr 1, 2020 at 10:35 pm

    Great, Thank you very much…

    Reply
    • WPBeginner Support says:
      Apr 2, 2020 at 8:36 am

      You’re welcome :)

      Reply
  32. Michael Ogbonnaya says:
    Mar 30, 2020 at 9:01 pm

    Thank you so much. This solved my problem.

    Reply
    • WPBeginner Support says:
      Mar 31, 2020 at 10:17 am

      You’re welcome, glad we could be helpful :)

      Reply
  33. Abdulbasit Rubeiyya says:
    Mar 12, 2020 at 6:40 am

    Thanks Alot, worked for me

    Reply
    • WPBeginner Support says:
      Mar 12, 2020 at 8:46 am

      You’re welcome, glad our guide worked :)

      Reply
  34. manoush says:
    Mar 2, 2020 at 1:11 pm

    thanks for information.
    solved my problem.

    Reply
    • WPBeginner Support says:
      Mar 3, 2020 at 10:11 am

      You’re welcome, glad our guide could help :)

      Reply
  35. Adam says:
    Feb 27, 2020 at 5:50 pm

    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.

    Reply
    • WPBeginner Support says:
      Feb 28, 2020 at 10:06 am

      Normally wp-config but it would depend on your specific hosting and the settings.

      Reply
  36. Edgar says:
    Jan 28, 2020 at 6:13 pm

    A lot of thanks!

    Reply
    • WPBeginner Support says:
      Jan 29, 2020 at 8:41 am

      You’re welcome :)

      Reply
  37. arjun says:
    Jan 27, 2020 at 7:44 am

    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

    Reply
    • WPBeginner Support says:
      Jan 27, 2020 at 11:43 am

      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.

      Reply
  38. fazan says:
    Jan 16, 2020 at 2:25 am

    thanks you wpbeginner
    you solve my problom
    but i have vps , can i increes more memory limit
    please reply

    Reply
    • WPBeginner Support says:
      Jan 16, 2020 at 8:33 am

      You would need to reach out to your hosting provider for what is available to you

      Reply
  39. Ionut Pomirleanu says:
    Jan 14, 2020 at 3:36 am

    Thanks wpbeginner

    Reply
    • WPBeginner Support says:
      Jan 14, 2020 at 8:59 am

      You’re welcome :)

      Reply
  40. Ananth Gurunathan says:
    Jan 9, 2020 at 1:39 am

    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.

    Reply
    • WPBeginner Support says:
      Jan 9, 2020 at 10:19 am

      You’re welcome, glad we could help solve the issue :)

      Reply
  41. Sandeep says:
    Aug 25, 2019 at 11:11 am

    Thanks wpbeginner for this article, i have solved my problem with the help of this article

    Reply
    • WPBeginner Support says:
      Aug 26, 2019 at 10:53 am

      You’re welcome, glad our guide could be helpful :)

      Reply
  42. Shahid says:
    Jul 30, 2019 at 9:52 am

    Thanks.. That worked like a charm :)

    Reply
    • WPBeginner Support says:
      Aug 1, 2019 at 9:00 am

      Glad our article could help :)

      Reply
  43. Handsome says:
    Jul 24, 2019 at 8:28 pm

    Thank you so much. That worked great for me!

    Reply
    • WPBeginner Support says:
      Jul 25, 2019 at 11:37 am

      Glad our recommendations could help :)

      Reply
  44. Ankur Verma says:
    Jul 24, 2019 at 1:13 pm

    It works! Thank You.

    Reply
    • WPBeginner Support says:
      Jul 25, 2019 at 10:46 am

      Glad our article could help :)

      Reply
  45. Peter says:
    May 30, 2019 at 12:27 pm

    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.

    Reply
    • WPBeginner Support says:
      May 31, 2019 at 10:10 am

      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.

      Reply
  46. Peter says:
    May 28, 2019 at 3:53 pm

    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.

    Reply
    • WPBeginner Support says:
      May 29, 2019 at 10:00 am

      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/

      Reply
  47. Yash Trivedi says:
    May 3, 2019 at 8:53 pm

    Correct Solution for me…..Thank You So much wpbeginer

    Reply
    • WPBeginner Support says:
      May 6, 2019 at 1:34 pm

      Glad our article could help :)

      Reply
  48. Saran says:
    Apr 16, 2019 at 11:52 pm

    Solved. Many Many thanks bro

    Reply
    • WPBeginner Support says:
      Apr 17, 2019 at 11:20 am

      Glad our article could help :)

      Reply
  49. Achraf says:
    Apr 11, 2019 at 10:52 am

    I love you ! you’re a life saver !

    Reply
    • WPBeginner Support says:
      Apr 11, 2019 at 10:54 am

      Glad our article could help :)

      Reply
  50. Wim Hoogenraad says:
    Apr 4, 2019 at 7:59 am

    I wish I known that earlier. Now | lost a lot of traffic for my site.
    Hopefully it is fixed now!

    Reply
    • WPBeginner Support says:
      Apr 4, 2019 at 11:44 am

      Hope our article helped you resolve the problem :)

      Reply
« 1 … 4 5 6

Leave a Reply Cancel reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

Over 1,320,000+ Readers

Get fresh content from WPBeginner

Featured WordPress Plugin
WPForms Logo
WPForms
Drag & Drop WordPress Form Builder Plugin. Learn More »
How to Start a Blog How to Start a Blog
I need help with ...
Starting a
Blog
WordPress
Performance
WordPress
Security
WordPress
SEO
WordPress
Errors
Building an
Online Store
Useful WordPress Guides
    • 7 Best WordPress Backup Plugins Compared (Pros and Cons)
    • How to Fix the Error Establishing a Database Connection in WordPress
    • Why You Need a CDN for your WordPress Blog? [Infographic]
    • 30 Legit Ways to Make Money Online Blogging with WordPress
    • Self Hosted WordPress.org vs. Free WordPress.com [Infograph]
    • Free Recording: WordPress Workshop for Beginners
    • 24 Must Have WordPress Plugins for Business Websites
    • How to Properly Move Your Blog from WordPress.com to WordPress.org
    • 5 Best Contact Form Plugins for WordPress Compared
    • Which is the Best WordPress Popup Plugin? (Comparison)
    • Best WooCommerce Hosting in 2020 (Comparison)
    • How to Fix the Internal Server Error in WordPress
    • How to Install WordPress - Complete WordPress Installation Tutorial
    • Why You Should Start Building an Email List Right Away
    • How to Properly Move WordPress to a New Domain Without Losing SEO
    • How to Choose the Best WordPress Hosting for Your Website
    • How to Choose the Best Blogging Platform (Comparison)
    • WordPress Tutorials - 200+ Step by Step WordPress Tutorials
    • 5 Best WordPress Ecommerce Plugins Compared
    • 5 Best WordPress Membership Plugins (Compared)
    • 7 Best Email Marketing Services for Small Business (2020)
    • How to Choose the Best Domain Registrar (Compared)
    • The Truth About Shared WordPress Web Hosting
    • When Do You Really Need Managed WordPress Hosting?
    • 5 Best Drag and Drop WordPress Page Builders Compared
    • How to Switch from Blogger to WordPress without Losing Google Rankings
    • How to Properly Switch From Wix to WordPress (Step by Step)
    • How to Properly Move from Weebly to WordPress (Step by Step)
    • Do You Really Need a VPS? Best WordPress VPS Hosting Compared
    • How to Properly Move from Squarespace to WordPress
    • How to Register a Domain Name (+ tip to get it for FREE)
    • HostGator Review - An Honest Look at Speed & Uptime (2020)
    • SiteGround Reviews from 4196 Users & Our Experts (2020)
    • Bluehost Review from Real Users + Performance Stats (2020)
    • How Much Does It Really Cost to Build a WordPress Website?
    • How to Create an Email Newsletter the RIGHT WAY (Step by Step)
    • Free Business Name Generator (A.I Powered)
    • How to Create a Free Business Email Address in 5 Minutes (Step by Step)
    • How to Install Google Analytics in WordPress for Beginners
    • How to Move WordPress to a New Host or Server With No Downtime
    • Why is WordPress Free? What are the Costs? What is the Catch?
    • How to Make a Website in 2020 – Step by Step Guide
Deals & Coupons (view all)
IPVanish Coupon
Get 20% OFF on IPVanish, one of the best VPN service providers for bloggers and WordPress users.
Theme Trust
ThemeTrust Coupon
Get 20% off on all ThemeTrust themes brought to you by Henry Jones.
Featured In
About WPBeginner®

WPBeginner is a free WordPress resource site for Beginners. WPBeginner was founded in July 2009 by Syed Balkhi. The main goal of this site is to provide quality tips, tricks, hacks, and other WordPress resources that allows WordPress beginners to improve their site(s).
Join our team: We are Hiring!

Site Links
  • About Us
  • Contact Us
  • FTC Disclosure
  • Privacy Policy
  • Terms of Service
  • Free Blog Setup
  • Free Business Tools
Our Sites
  • OptinMonster
  • MonsterInsights
  • WPForms
  • SeedProd
  • Nameboy
  • RafflePress
  • Smash Balloon

Copyright © 2009 - 2021 WPBeginner LLC. All Rights Reserved. WPBeginner® is a registered trademark.

Managed by Awesome Motive | WordPress hosting by SiteGround | WordPress CDN by MaxCDN | WordPress Security by Sucuri.