Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Introduction

Normally PHP scripts are compiled at runtime, each time you request a page this will happen again, this is where opcache comes in, opcache caches the compiled bytecode, so any subsequent request will not require a complete compile of all the requested PHP code.

For PHP applications which have a contain a lot of PHP code like the WebApp or Z-Push it is highly recommended to enable opcache, as this can speed up the loading of pages substantially and lower the web server load as well.

Opcache is usually included with PHP 5.5.0 and later and therefore it is included in most distributions.

Enabling opcache

On certain Distributions which ship PHP 5.6.0 or higher opcache is enabled by default, for example this is the case with Debian 8 and Ubuntu 16.04

On Rhel/CentOS systems with rh-php56 or rh-php70* from the Software Collections installed, it is required to install the respective rh-php56-php-opcache or rh-php70-php-opcache package.

If you are on PHP 5.2.0 or higher you can also build opcache yourself, see the following page for the tarballs https://pecl.php.net/package/ZendOpcache

* Note: Kopano does not provide an MAPI module for rh-php70 at this time.

Example

To enable opcache on CentOs 6 or CentOS 7 with httpd24-httpd and rh-php56 installed.

# yum install rh-php56-php-opcache -y

After this it is required to restart Apache to activate the opcache module.

# service httpd24-httpd restart

Further information

For more information about PHP opcache please visit http://php.net/manual/en/book.opcache.php at php.net.

Alternatives

For older PHP versions you might look into to following opcode caching modules, which might be available for your Linux Distribution.

  • No labels