Fatal error: Allowed memory size of 33554432 bytes exhausted … Yeah!

Has this ever happened to you. In WordPress?

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 14016 bytes) in foo.php on line 895

Well it totally can happen and here’s what you can do to fix it.

First of all, the error is related to PHP, and it happens when…you’re out of memory! In the above error, I can pretty much guarantee that your memory limit directive in your php.ini file is set to 32M. But how do you check? Here’s an easy way.

Create or touch a file in public_html called phpinfo.php. Edit that file and put the following in it:

<?php phpinfo(); ?>

Now browse to http://www.yourdomain.com/phpinfo.php and it’s all there! Everything you need to know about your php directives and shit.

Now look for the “memory_limit” directive. Does it look like this:

memory_limit = 32M

If it does, you probably want to change it to this:

memory_limit = 64M

You need to have access to your php.ini file. If you don’t know where to find it, once again, look at your phpinfo.php page we just made. And look for this:

Loaded Configuration File

It probably has a path like /usr/local/lib/php.ini, or maybe it’s something different. Wherever your php.ini file is, edit it and look for the memory_limit directive, and change it to the following, like I said above.

memory_limit = 64M

And that’s it! Now all your problems should be solved. Except maybe for the one about making this month’s rent. Goddamn it!


Leave a Reply