• Blogging
  • Freebies
  • Freeware
  • How-To
  • Make Money Online
  • Mobile
  • Home >> How-To >> WordPress Fatal error: Allowed memory size of xxx bytes exhausted (Solved) – PHP Error

    WordPress Fatal error: Allowed memory size of xxx bytes exhausted (Solved) – PHP Error


    Wordpress Fatal error - Allowed memory size of xxx bytes exhaustedI started facing problems of White Screen of Death (WSOD) problems and Blog slowing down after upgrading my Blog to WordPress 2.8. I was able to resolved them.

    But, started facing the following problems recently :

    • Encountering “Wordpress Fatal error: Allowed memory size of xxx bytes exhausted” when trying to do Automatic Upgrading of WordPress
    • “Wordpress Fatal error: Allowed memory size of xxx bytes exhausted” appearing in the WordPress Dashboard

    What does Error mean ?

    WordPress runs on PHP. It means though the error you are getting is on your WordPress Blog. But, it is related to PHP Error

    You get this kind of error “Wordpress Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 16842 bytes) in wp-db.php on line 501”

    The above is the error i was getting in the WordPress Dashboard

    Reason for this “Wordpress Fatal error:”

    The reason is simple. Your WordPress blog is overloading your PHP with lots of instructions and thereby exhausting the memory.

    Therefore, This is an memory issue. It can be solved easily by changing some WordPress Core file.

    How to solve “Wordpress Fatal error: Allowed memory size of xxx bytes exhausted” Error

    Below, is the best possible solution to resolve the issue. I have personally done this for this Blog. You will be changing two files php.in and wp-settings.php

    Before you change modify files mentioned below, Please take a back up of it!

    1. Login in your host provider website and click File Manager.
    2. Try to find php.ini file on the root of your site. Mine was located in public_html folder.
    3. Open php.ini in any editor they support. Look for “memory_limit” (without quotes)
      memory_limit = 32M      ; Maximum amount of memory a script may consume (32MB)

      You should find a line similar to the one above.

    4. Try to increase the Number by multiplying by 2. For ex: if your php.ini shows 16M then try changing 32M.

      In my case, i changed it to 64M.

      Here we are telling PHP to use 64M of memory instead of 32M.

    5. Save the file and close the editor
    6. Now move to your wordpress directory and look for wp-settings.php file and open in File Editor
    7. Look for the following two lines
      if ( !defined('WP_MEMORY_LIMIT') )
      	define('WP_MEMORY_LIMIT', '32M');
    8. Once you find it, Try changing it to the number that you have changed in php.ini in the above steps. In my case i changed the second line to 64M

      Here we are trying to increase the Memory usage of WordPress by telling WordPress to use 64M instead of 32M by modifing it in wp-settings.php

      Remember : You will need to make the above change to wp-settings.php after you upgrade the WordPress. As these changes will be overwritten by new file

    9. Save the file and close the editor

    Now, you are done. Try loading WordPress Dashboard page or any WordPress page where you were getting “Wordpress Fatal error: Allowed memory size” error. Most probably, you won’t see it.

    I was able to solve it.

    Hope you can also solve/fix WordPress Fatal error: Allowed memory size of xxx bytes exhausted

    If you find this information helpful, then do give your thanks and also suggestions or other tips you know via Comments!

    IMPORTANT: This blog welcomes Guest Bloggers, Writers to also contribute by writing Guest Posts and also Make Money!. Check out our Revenue Sharing Program
    1924 readers are already subscribed to this blog! Why don't you be one of them? Subscribe to this blog via your favorite RSS feed reader or by entering your email address on the form below:





    19 Comments

    1. Lyndi says:

      This will work just fine but I am a bit concerned about making any changes to the core files. You could end up having to repeat your changes every time a new version of WordPress is released.

      You could add the following line to the wp-config.php file:

      define(‘WP_MEMORY_LIMIT’, ’64M’);

      This file is not overwritten when you upgrade WordPress. Not all hosts will allow this but in this case this setting will do nothing and the default of 32M will be used.

    2. earningstep says:

      damn it , you have a nice tips here . i will copy this tips to my notepad . thanks

    3. I never had an error like this, thanks for the tips, they might help if I face it in future

    4. I have faced this problem but I replaced my function.PHP file using FTP then error was removed.
      But before all things Blog backup is necessary part.

    5. Ruchi says:

      Luckly never had this error. I will remember for future , if I face this problem. Thanks for sharing .

    6. Luckily i have not faced this error so far. Bookmarking this post as it might come useful in the future

    7. Heeren says:

      HI Nihar,

      just got this error on my blog admin tried this tip but didnt work so submitted a ticket with my host

      Thanks
      Heeren

    8. Greg says:

      I ran into this problem today, and your post was a lifesaver (metaphorically speaking)! Thanks!

    9. Chaitanya says:

      Hi,

      I got the same problem, but when I opened my php.ini file, the memory_limit line is not there!!! I checked extensively for information on that and everyone says the same thing, but I dont understand why my php.ini file has no memory limit??

      Well, keeping that aside…What I did was I added the memory_limit line to 96M and the rest of the changes I made in the wp-settings file just as recommended.

      I am not getting the fatal error now, but My Thesis Options wont load!! I mean If I make changes in Thesis Options, It takes for ever to reload and when it does…the changes are not made!! I am very confused now and also worried

      Can you help me out of this fix!! please

    Leave a Reply

    page counter
    NiharsWorld RSS Feed