Beginner's Guide for WordPress / Start your WordPress Blog in minutes

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.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit – a collection of WordPress related products and resources that every professional should have!

Reader Interactions

437 CommentsLeave a Reply

  1. Great article, i encountered this problem when i installed a new wordpress theme. While you have accurately told us how to solve this problem, i’m thinking what is the impact of having a website that runs on high php memory on web hosting resources, etc?

    Many thanks.

    • Hey Joshua,

      It depends. If you are on shared hosting and your website is continuously using more memory than it should, then your web host will automatically kill that particular process.

      Admin

  2. I always forget how to fix this error when I encounter it. Luckily I found your post, and it worked like a charm. Panic mode is now over. Thank you!

  3. Thanks for the tut, good stuff!

    QUESTION: After increasing from the default 64M to 256M, my white screen disappeared and the site is up. Is there a reason to scale down the memory again?

    Cheers,
    Jos

  4. Today is the second time that I’ve needed to refer to this post (bad memory – much like my site).

    Great info, keep up the fantastic work.

  5. Hi!
    How can I mixed this error?
    Fatal error: Allowed memory size of 176160768 bytes exhausted (tried to allocate 78 bytes) in /home/brandkpl/public_html/wp-includes/taxonomy.php on line 3146

  6. Hi there,

    Is there a way to increase the memory and make sure it stays that way when updating WP?

    Everything I update my site, I have to do it all over again…

    Thanks for your help!

  7. i also found that there could be a chance that in the root folder there will be a “maint” folder, although normally this will give you a screen saying its under maint which you will then know what to do.

    but in my instance the “Maint” in the root folder just showed the WSOD once it was removed i was back up and running.

  8. Allowed memory size of 67108864 bytes exhausted (tried to allocate 229376 bytes)
    My Problem is this

  9. Nice one, i wonder I could increase the memory of instant wp aplication in order to successfully migrate my blog in blogger to wordpress.

  10. Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 78 bytes) in /home/xxxx/public_html/wp-includes/wp-db.php on line 1837

  11. Hi,
    i am getting this error, while importing demo and uploading plugin.
    i have already try out these methods. pls help.
    500 – Internal server error.
    There is a problem with the resource you are looking for, and it cannot be displayed.

  12. I increased the limit to 128M but the same problem. Then I increased it to 256M and now its working fine.

  13. Hi, this sounds like the issue I’m having with Prophoto – however I can’t login to the admin area – as I get a blank white screen – to make the changes you suggest, is there another way? Thanks so much

  14. Hey, I probably have a huge problem here.. but the only wp-config file I can find on my Air is wp-config-sample.php.

    total blank webpage situation – i doubt it’s memory since i don’t have more than a couple pages…

  15. It’s usually easier to get your web host to do this rather then doing it manually, if you screw something up you can make your website worse.

  16. “First open your wp-config.php which is located in the root WordPress directory. Then add the following line inside the main php tag:”

    I really have no idea what to click to find the wp-config.php or the root WordPress Directory. Is it in the Settings? :D Sorry. I just can’t figure out. :) Thanks.

  17. Thank you so much for this! Me and my office manager was about to pull our hair out because we couldn’t figure out how to increase the memory limit on a website we were working for a client. We actually increased the memory to ‘128M’ because ’64M’ was already there and it worked like a charm. Thanks!

Leave a Reply to Jason Didner 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.