This is an old revision of the document!


PHP Opcode Caching: General Overview

This wiki will cover the basic of opcode caching — what it does and its limitations. We recommend this wiki for users who are new to opcode caching.

Opcode caches speed up PHP by caching the compiled opcode of PHP scripts. The server can then use this opcode to respond to requests for a PHP script instead of parsing and compiling the source code for each request. This opcode is stored in shared memory for faster processing. All opcode caches will allow you to set the limit for how much of this RAM may be allocated to opcode caching.

- Opcode caching requires extra RAM. The RAM limit you set for opcode caching will be automatically partitioned off. You will lose access to this RAM for other uses. - Opcode caching requires PHP processes be forked from the same parent process in order to share the cache. If the process is killed, the cache is flushed. This is why opcode caching does not work well with Apache's suPHP -- suPHP starts a new process for each PHP process, causing opcode cache to be flushed almost as soon as it was created. LiteSpeed's suEXEC Daemon mode and ProcessGroup have been developed for greater use of opcode caching. - Opcode caches can be buggy. Many users find that choosing an opcode cache is a matter of trial and error -- different opcode caches work better in different setups.

  • Admin
  • Last modified: 2014/05/20 21:44
  • by Michael Armstrong