PHP5.5/CentOS6でZend OPcacheをインストールする方法

opcacheパッケージを検索

yum searchで検索してみると、
$ yum search --enablerepo=remi-php55,remi opcache
========================= N/S Matched: opcache ==========================
php-opcache.x86_64 : The Zend OPcache
php-pecl-zendopcache.x86_64 : The Zend OPcache
2件ヒットしました。
yum infoで詳しく見てみると、
$ yum info --enablerepo=remi-php55,remi php-opcache php-pecl-zendopcache
Available Packages
Name        : php-opcache
Arch        : x86_64
Version     : 5.5.10
Release     : 1.el6.remi.1
Size        : 105 k
Repo        : remi-php55
Summary     : The Zend OPcache
URL         : http://www.php.net/
License     : PHP
Description : The Zend OPcache provides faster PHP execution through opcode caching and
            : optimization. It improves PHP performance by storing precompiled script
            : bytecode in the shared memory. This eliminates the stages of reading code from
            : the disk and compiling it on future access. In addition, it applies a few
            : bytecode optimization patterns that make code execution faster.

Name        : php-pecl-zendopcache
Arch        : x86_64
Version     : 7.0.3
Release     : 1.el6.remi
Size        : 98 k
Repo        : remi
Summary     : The Zend OPcache
URL         : http://pecl.php.net/package/ZendOpcache
License     : PHP
Description : The Zend OPcache provides faster PHP execution through opcode caching and
            : optimization. It improves PHP performance by storing precompiled script
            : bytecode in the shared memory. This eliminates the stages of reading code from
            : the disk and compiling it on future access. In addition, it applies a few
            : bytecode optimization patterns that make code execution faster.
うむむ・・2つある。
いったい何が違うのでしょうか・・・

PHP5.5自体はremi-php55レポジトリでインストールしたので、"php-opcache"の方がよさそうな気がします。(直感)
php-opcacheを yum install してみます。
vagrant@localhost:~% sudo yum install --enablerepo=remi,remi-php55 php-opcache
=============================================================================================================================================================
 Package                              Arch                            Version                                      Repository                           Size
=============================================================================================================================================================
Installing:
 php-opcache                          x86_64                          5.5.10-1.el6.remi.1                          remi-php55                          105 k

Transaction Summary
=============================================================================================================================================================
Install       1 Package(s)

Total download size: 105 k
Installed size: 267 k
Is this ok [y/N]: y
Downloading Packages:
php-opcache-5.5.10-1.el6.remi.1.x86_64.rpm                                                                                            | 105 kB     00:01
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : php-opcache-5.5.10-1.el6.remi.1.x86_64                                                                                                    1/1
  Verifying  : php-opcache-5.5.10-1.el6.remi.1.x86_64                                                                                                    1/1

Installed:
  php-opcache.x86_64 0:5.5.10-1.el6.remi.1
入りました!
vagrant@localhost:~% sudo find /usr/ -name 'opcache.so'
/usr/lib64/php/modules/opcache.so
/usr/lib64/php-zts/modules/opcache.so
キタ!

動作確認
vagrant@localhost:~% php -v
PHP 5.5.10 (cli) (built: Mar 11 2014 17:37:46)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
できましたーーー!!

おまけ


だそうです。
つまりPHP5.5.なら php-opcache を使えばよいということですね。
ありがとうございます!
カテゴリ: