Laurent Hinoul

“Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.” - John F. Woods

how to fix unable to allocate memory for pool error

In this post, I will tell you how to fix the PHP error Unable to allocate memory for pool.

You will see this error in your error.log file as this:

The problem is that you have not enough memory configured to your APC cache.Standard, APC has a memory limit of 32MB. When your APC cache is full, you will have many cache misses and that causes the error (see image below).

apcmiss

To fix this, open the apc.ini file and update the apc.shm_size value. Start with 128MB;

Now, you have to test if this is enough memory. To do so, you can download a file named apc.php. This can be found here.

You need to upload this file to your root. When you surf to http://…/apc.php, you will see a statistics page. This page tells you everything about the APC cache. When you have enough memory, the cache hits should be greater that the cache misses and the cache full count should be 0. To test properly, make sure your server runs for more than one day so you have a realistic view.

apcphp

Thanks for reading this post. Please like ‘n share if it helped you 🙂

Leave a Reply

%d bloggers like this: