PHP7 Opcache

表題の件について。しばし触っていなかったPHP。サイト表示を速くしたいとの依頼から、”APC“を入れれば良いのでは?と思ったが最近は違うようだ。

■ 環境

  • PHP 7.0.16
  • Amazon Linux

■ apcu

APC“で検索してみると下記の結果を得られた。

$ sudo yum search apc
Loaded plugins: priorities, update-motd, upgrade-helper
================= N/S matched: apc ==================
apc-panel.noarch : APC control panel
apcu-panel.noarch : APCu control panel
apcu70-panel.noarch : APCu control panel for php 7.0
php-ZendFramework-Cache-Backend-Apc.noarch : Zend Framework APC cache backend
php-pecl-apc.x86_64 : APC caches and optimizes PHP intermediate code
php-pecl-apc-devel.x86_64 : APC developer files (header)
php54-pecl-apc.x86_64 : APC caches and optimizes PHP intermediate code
php54-pecl-apc-devel.x86_64 : APC developer files (header)
php55-pecl-apc.x86_64 : APC caches and optimizes PHP intermediate code
php55-pecl-apc-devel.x86_64 : APC developer files (header)
php55-pecl-apcu.x86_64 : APC User Cache
php55-pecl-apcu-devel.x86_64 : APCu developer files (header)
php56-pecl-apcu.x86_64 : APC User Cache
php56-pecl-apcu-devel.x86_64 : APCu developer files (header)
php70-pecl-apcu.x86_64 : APC User Cache
php70-pecl-apcu-devel.x86_64 : APCu developer files (header)
perl-Mail-IMAPClient.noarch : An IMAP Client API

  Name and summary matches only, use "search all" for everything.
$

apcu“?”u“とは何だ?と少々違和感を感じた。調べてみるとPHP5.5以降からAPCは”opcache + APCu“という組み合わせになったようだ。とりあえず何も考えずに”opcache“を入れることにした。

■ opcache

$ sudo yum search opcache
Loaded plugins: priorities, update-motd, upgrade-helper
================= N/S matched: apc ==================
php55-opcache.x86_64 : The Zend OPcache
php56-opcache.x86_64 : The Zend OPcache
php70-opcache.x86_64 : The Zend OPcache

  Name and summary matches only, use "search all" for everything.
$

これをインストールする。

$ sudo yum install php70-opcache

versionを確認すると表示された。

$ php -v
PHP 7.0.16 (cli) (built: Mar  6 2017 19:45:42) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.16, Copyright (c) 1999-2017, by Zend Technologies
$

設定ファイルも下記にあるようだ。

/etc/php-7.0.d/10-opcache.ini

以上。

コメントを残す

メールアドレスが公開されることはありません。

CAPTCHA


このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください