14.7. Using APC (Advanced PHP Cache)

One of the biggest performance problems with PHP code has been that requests take longer the more the code PHP parses. Fortunately, there is now a solution: opcode caches. An opcode cache works by caching the output from Zend's compiler in shared memory so subsequent requests do not have to reparse the same code again and again.

APC is a popular open-source cache for PHP written by George Schlossnagle and Daniel Cowgill, available through PECL:

shell$ pear install apc

To use APC, you need shared memory enabled in your operating system. You also need the following snippet added to your php.ini file:

apc.enable = yes
apc.shm_size = 4

APC will not start up unless apc.enable is true. The apc.shm_size directive ...

Get PHP 5 Power Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.