{ claus.conrad }

Zend OPcache for PHP on SmartOS

πŸ“… Apr 10, 2013
βŒ› 2 minutes

Installing an opcode cache such as Zend OPcache is a simple way to improve your PHP's performance on SmartOS. Here's how.

Zend OPcache (previously known as Zend Optimizer+) is one of several opcode caches for PHP, the other most well-known being APC and eAccelerator. Zend Optimizer Plus has been available in binary form together with Zend Server (CE) for some time, but Zend recently decided to contribute the code to the PHP project. Thus it can now be used on platforms such as SmartOS, where Zend Server isn’t an option. Thank you Zend! :)

Zend OPcache will be part of PHP from the upcoming 5.5 version, but the source code is compatible with PHP 5.2 and later versions. See below for installation steps.

Manual installation

  1. Update your package database:
    pkgin up

  2. Install prerequisites for building Zend OPcache:
    pkgin in unzip php54-pear gmake gcc47 autoconf

  3. Download and unpack the code:
    wget --no-check-certificate https://github.com/zend-dev/ZendOptimizerPlus/archive/master.zip unzip master rm master

  4. Build the extension:
    cd ZendOptimizerPlus-master/ phpize ./configure --with-php-config=/opt/local/bin/php-config make make test make install

Activating the extension

  1. Edit your php.ini:
    vi /opt/local/etc/php.ini

  2. Add the following line at the bottom of the file and save it:

  3. If you are using PHP-FPM, restart it:
    svcadm restart php54-fpm

Checked and updated on September 17, 2013.