Solution to APC / PHP Warning: Unknown: Unable to allocate memory for pool. in Unknown on line 0

| | 1 min read

APC or Alternative PHP Cache (APC) is a free and open opcode cache for PHP. APC allows for caching of opcode generated during PHP script parsing and execution by the Zend engine. If you are using APC 3.1.9 and you are using the default configuration you might run into the error where most PHP requests will return a warning message "PHP Warning: Unknown: Unable to allocate memory for pool. in Unknown on line 0"

The error is that APC cache ran out of memory and a new cache item could not be inserted. The solution to the problem is to change APC configuration settings and decrease apc.ttl and increase apc.shm_size. Decreasing the TTL will expire items from the cache faster and allow for new space to be available for new cache entries. Increasing shared memory size will allow for more items to be cached.