CentOS 7.2 の PHP 7.0 に OPcache をインストール

CentOS 7.2 の PHP 7.0 に OPcache をインストールしてみたので、その方法をシェアします。

CentOS 7.2 の PHP 7.0 に OPcache をインストールしてみたのでメモ。

CentOS 7.2 に PHP 7.0 をインストール」でインストールした PHP が前提。

# yum --enablerepo=epel,remi-php70 install php-opcache

これで OPcache をインストールして、php.ini の末尾に下記の設定を追記(とりあえず公式ページのサンプルそのまま)。

opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
opcache.enable_cli=1

確認

# php -v
PHP 7.0.10 (cli) (built: Aug 31 2016 18:07:34) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
 with Zend OPcache v7.0.10, Copyright (c) 1999-2016, by Zend Technologies

Apache を再起動して完了。

# service httpd restart
Published 2016-09-05
Updated 2019-06-25