Get Out of the PHP Memory Error Rut with WordPress

We’ve all been there: You drag yourself out of bed in the morning, crawl to your computer, and boot up the oh-so-familiar blog space. But instead of finding your lovingly crafted website, complete with self-made logos and beautiful banners, all you find is this error:
Fatal error: Allowed memory size of ######## bytes exhausted (tried to allocate ## bytes) in /home/user/public_html/wp-includes/phpfile.php on line 80.
Before you start swearing at your monitor or worse—we’re thinking that stapler looks appropriately weighted for some hefty hucking—know that this issue is easily fixed, and doesn’t have to be the day-wrecker you feel it might be.

RELATED:   Customizing Your Content Management System

It’s worth noting that your exact error message may vary, but as long as it says something about your memory being more worn out than an obese man at a 10k, you’re golden: The issue has to do with available computing space, and you’re still reading the right tutorial.

The likely issue is that you’ve just installed a new plug-in or extension, and now WordPress is acting like an estranged lover. There are a couple of ways to correct the issue. The easiest is to disable any recently installed extensions and see if that corrects the problem. However, this is certainly less than desirable, as you likely want that new piece of code. With that in mind, you might try to expand the available memory space for your site. This can be accomplished in the following way:

RELATED:   WordPress vs. Blogger

Essentially, you’ll need to change the amount of memory available for PHP. This can be done in a number of ways, and it might be that there’s only one that works for your server. Always query your web host first—or if you’re feeling gung-ho, locate your php.ini file and do this to it!
Locate the following line:
[code lang=”php”]memory_limit = 32M ; Maximum amount of memory a script may consume[/code]
Change “32M” to “64M,” and then cross your fingers. Some hosts limit the amount of memory you can delegate yourself to PHP, so if this doesn’t correct the issue, therein may lie your problem. If you can’t acquire access to php.ini, you might try adding the same line to the .htcaccess file in your WordPress main installation folder.

RELATED:   Trending Tweets You May Have Missed

If none of those are possible, then you’re in a sticky boat, Pilgrim: Call up the tech-support you’re paying for and get them to do one of the things we just discussed.