How to Fix Fatal Errors Due to Memory in PHP

by on 06/14/2009 in Tech

If you are getting a Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 8200 bytes) in /home/xxxxx/public_html/xxx/wp-includes/wb.php in your WordPress Admin area do not panic. There’s an easy solution to solving this issue.

How to fix this issue:

  1. Login to your Host Control Panel
  2. Look for PHP Config and click to navigate to that page

You should see something like the image below. This is the Control Panel that Bluehost offers if you are hosting with them.

phpini-1

Note: I have PHP5 selected as this is the best setting when it comes to performance.

The php.ini may not be loaded by default. To load a php.ini file into your root directory (PUBLIC_HTML) follow the steps below.

  1. Go into your CPanel (Control Panel) by logging into your host
  2. Click on the Install PHP.INI MASTER FILE. See image below. You do not need to select the IonCube or SourceGuardian to load a php.ini file
  3. Open your FTP Client
  4. Login to your server where your web site resides
  5. Look for the php.ini.default file in your root directory (public_html or www)
  6. Download this to your computer
  7. Rename it to php.ini
  8. Open it in notepad and look for Resource Limits
  9. Change memory_limit = 32M to 64M or whatever setting you would like
  10. Save your php.ini
  11. Upload your new php.ini and delete the php.ini.default that you originally created

All done!
phpini-2

You now have a master php.ini in your public_html directory. You can then edit the file with any custom directives your scripts require. You can also select to have the file include the settings for IonCube and/or SourceGuardian.

NOTES: If you have custom handlers specified in ~/public_html/.htaccess, changing these settings can overwrite them. If you are not sure, make a backup of ~/public_html/.htaccess before changing settings.

Share

9 Responses to “How to Fix Fatal Errors Due to Memory in PHP”

  1. BloggerBiLL

    Jun 14th, 2009

    Frank this is good info.People don’t worry about it until they are searching for a FIX hopefully they ALL come to you.
    Stumbled

    • Frank J

      Jun 14th, 2009

      John,

      It happened when I upgraded to WP 2.8. This is why I posted it so others may find it in search results.

  2. Jeet

    Jun 14th, 2009

    One must be very careful while changing php.ini, a single line change can break a lot of things ;-) In my case it disabled URL rewriting once.

  3. Kikolani

    Jun 15th, 2009

    Thanks for the heads up… I’m sure lots of people will find this useful!

    ~ Kristi

  4. Fool

    Aug 6th, 2009

    Thank you and thank you again! Now If I can handle doing it!

    • Frank J

      Aug 6th, 2009

      My Fool——I love ya bro!

      • Fool

        Aug 7th, 2009

        You Da Man, worked like a charm I think it has something to do with the number of plug-ins I had installed. How you likin Blue Host?

        • Frank J

          Aug 7th, 2009

          Fool,

          Very cool! I am happy to hear it worked for you!

  5. [...] have to publicly thank my friend Frank over at techjaws for this particular post. You see I have been more of a fool than normal and could not for the life of me figure out how to [...]