[PHP][APC] Warning: require_once(): Unable to allocate memory for pool.

Tadashi Shigeoka ·  Sun, December 9, 2012

I found the error “Warning: require_once(): Unable to allocate memory for pool.” being output to the error log in PHP.

This appears to be an APC bug.

PHP :: Bug #58982 :: apc produces tons of warnings “Unable to allocate memory for pool.”

I resolved this by changing the configuration in /etc/php.d/apc.ini.

apc.mmap_file_mask=/tmp/apc.XXXXX

↓ (Changed to)

apc.mmap_file_mask=/dev/zero
apc.mmap_file_mask string

If compiled with MMAP support by using —enable-mmap this is the mktemp-style file_mask to pass to the mmap module for determining whether your mmap’ed memory region is to be file-backed or shared memory backed. For file-backed mmap, set it to something like /tmp/apc.XXXXXX (exactly 6 Xs). To use POSIX-style shm_open/mmap put a .shm somewhere in your mask. e.g. /apc.shm.XXXXXX You can also set it to /dev/zero to use your kernel’s /dev/zero interface to anonymous mmap. Leaving it undefined will force an anonymous mmap.

[Source]: PHP: 実行時設定 - Manual

That’s all from the Gemba.