Fatal Error: Memory Exhausted (WP Fix!)

January 26, 2008 at 5:58 pm Leave a comment

(This article was posted in short on my personal weblog, Zwinkyness. This is the longer version for those who would like to get more into detail).

WordPress is a script or CMS, if you prefer, that actually runs an entire website. Therefore, it has the tendancy to pass the amount of space a script, by default might take up. This limit (either 8 or 16 MB) is already installed by most hosting systems, even if you bought webhosting. If you go to your controlpanel and then to PHP indications or PHP settings or a title that looks alike, you will probably come across the words: Memory Size Limit. This is where the problem lies.

Many people run into this problem because they are simply not aware of this limit. With ordinary scripts, or a normal WP installation, it does not really matter that much anyway. But if you begin adding plugins to your installation, it might become an issue. Two plugins that seem to take up a lot of space are Gregarious and Google Sitemap Generator. However, if you really want to know the space taken by the scripts, you should check out your Disk Usage (which can probably also be found in your cpanel), which will give you a better idea of what is eating those 8 MB.

8 MB however, is not a lot. Besides, most people do not feel like dropping a couple of Plugins just to keep under that number. So, there are easy ways to fix this problem and more difficult ways. First of all, I heard about a .htaccess fix and a php.ini file, which one would have to create themselves, in order to change this 8 MB to a higher number. However, neither of the methods worked on my weblog (Zwinkyness), so I continued my search.

What eventually did the trick, was putting a certain code in my cache.php file (wp-includes/cache.php) right after the <?php tag

ini_set(‘memory_limit’,’32M’);

Rather than making a php.ini file, I included the ini settings in an already existing PHP file, which completely solved the problem. Please take note that you can change the M-number. For example, here I chose 32M just to make sure I would not cross that limit any time soon, but if you prefer you can always pick 13 or 10 or whatever. My only advice to you is not to go below the 8, since that might do not at all to help you solve the problem.

Another method that helps (but not if the problem already has occured: than you first need the above method to restore it) is the WP-Cache plugin. Since it stores files that were not changed outside the database, rather than updating it all over again, it uses up no space of your PHP script space. It makes the amount of MB your weblog uses much smaller.

In case the method I supplied here, did not help or if you want more help, you are free to comment here or visit any of the resources provided here:

  1. Support topic on WordPress Forums
  2. Support topic on WordPress Forums #2 (solved the problem for me)
  3. Increasing PHP on a virtual server (Support Forums)
  4. The .htaccess solution to fixing PHP Memory

Entry filed under: WordPress Fixes. Tags: , , , , , , , .

Hello world!

Leave a comment

Trackback this post  |  Subscribe to the comments via RSS Feed


Blog Elite

You don't have to be a genius to become a problogger. You don't need an IQ of above 140 to create a professional looking, nicely designed, flexible weblog. You don't need tons of cash to produce accessible, up-to-date themes. All you need is Blog Elite.
January 2008
M T W T F S S
 123456
78910111213
14151617181920
21222324252627
28293031  

Archives

Blog Stats

  • 398 visitors on this day.

Recent Comments

Mr WordPress on Hello world!

Feeds