O'Reilly logo

PHP 5 Power Programming by Derick Rethans, Stig Sæther Bakken, Andi Gutmans

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required