Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
litespeed_wiki:php:opcode_cache [2014/05/20 21:21]
Michael Armstrong
litespeed_wiki:php:opcode_cache [2014/05/22 14:04]
Michael Armstrong
Line 1: Line 1:
 ====== PHP Opcode Caching: General Overview ====== ====== PHP Opcode Caching: General Overview ======
  
-This wiki will cover the basic of opcode caching — what it does and its limitations.+LiteSpeed Web Server allows for effective use of opcode caching with shared hosting. Because Apache does not provide this capability, new LSWS users may want a brief introduction to opcode caching. ​This wiki will cover the basics ​of opcode caching — what it doesits limitations, and popular opcode caches.
  
 ===== What is opcode caching? ===== ===== What is 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.+Opcode ​caching speeds ​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 RAM may be allocated to opcode caching.
  
-This opcode is stored  ​+===== Opcode caching limitations =====
  
 +  - **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, so do not allow opcode caching to use too much of your RAM.
 +  - **Opcode caching requires PHP processes be forked from the same parent process in order to share the cache.** If the parent 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 [[http://​www.litespeedtech.com/​products/​litespeed-sapi/​php/​suexec-daemon-mode|suEXEC Daemon mode]] and [[http://​www.litespeedtech.com/​products/​litespeed-sapi/​php/​suexec-processgroup|suEXEC ProcessGroup]] have been developed for greater use of opcode caching with PHP suEXEC.
 +  - **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.
 +  - **Opcode caches can cause 503 errors.** This is an extension of the previous point. Opcodes caches are a frequent cause of 503 errors. Try turning off your opcode cache if you're getting 503 errors.
 +
 +===== Popular Opcode Caches =====
 +
 +  * [[http://​xcache.lighttpd.net/​|xCache]] -- Actively maintained and supports all PHP versions.
 +  * [[http://​pecl.php.net/​package/​ZendOpcache|Zend Opcache]] -- Actively maintained and supports PHP 5.2 and up.
 +  * [[litespeed_wiki:​php:​apc|APC (Alternative Opcode Cache)]] -- Appears to be discontinued. Supports PHP up to version 5.4, but has been reported buggy with PHP 5.4. May be a good solution for PHP 5.3.
 +  * [[http://​eaccelerator.net/​|eAccelerator]] -- Dead project. Supported PHP 5.4 and earlier.
  • Admin
  • Last modified: 2018/09/14 15:56
  • by Michael Alegre