Home>

I installed OPcache and APCu with the following command.
Even if it checks with "php -v" command, it is not reflected.
Is there any additional work required?

■ Commands executed for installation.

yum -y install --enablerepo = epel, remi, remi-php72 php72-php-opcache php72-php-pecl-apcu

■ Command execution environment
・ OS version: CentOS Linux release 7.6.1810 (Core)
・ PHP version: PHP 7.2.15

Thanks for your response.

■ Command execution result (second time)

[root @ localhost ~] # yum -y install --enablerepo = epel, remi, remi-php72 php72-php-opcache php72-php-pecl-apcu
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * epel: ftp.iij.ad.jp
 * extras: ftp.iij.ad.jp
 * remi: ftp.riken.jp
 * remi-php72: ftp.riken.jp
 * remi-safe: ftp.riken.jp
 * updates: ftp.iij.ad.jp
Package php72-php-opcache-7.2.25-1.el7.remi.x86_64 already installed and latest version
Package php72-php-pecl-apcu-5.1.18-1.el7.remi.x86_64 already installed and latest version
Nothing to do

Setting file does not exist

[root @ localhost ~] # ls /etc/php.d
20-bz2.ini 20-dom.ini 20-gd.ini 20-mbstring.ini 20-simplexml.ini 20-xml.ini 30-pdo_mysql.ini 40-zip.ini
20-calendar.ini 20-exif.ini 20-gettext.ini 20-mysqlnd.ini 20-sockets.ini 20-xmlwriter.ini 30-pdo_sqlite.ini
20-ctype.ini 20-fileinfo.ini 20-iconv.ini 20-pdo.ini 20-sqlite3.ini 20-xsl.ini 30-wddx.ini
20-curl.ini 20-ftp.ini 20-json.ini 20-phar.ini 20-tokenizer.ini 30-mysqli.ini 30-xmlreader.ini
  • Answer # 1

    If you haven't rewritten it to use OPcache and APCu,
    Even if you install it, it will not be used.

    Speed ​​up PHP 7 with OPcache and APCu (PHP accelerator) | Solve it yourself! If you don't cry, let's sing on your own.
    Introduction of APCu and OPcache PHP server acceleration | System Guardian

    In both reference articles, it seems that web server processes (http and nginx) are restarted by rewriting php.ini.


    [Added]
    In rare cases, php when accessing from a web browser and php that can be called on the command line are different,
    Because there is a possibility that multiple versions of php are included,
    Now that I have installed OPcache and APCu


    Just put the php file you just wrote and run it to see how those settings are.
    (Maybe it may conflict with the information in php -i.)
    As long as the yum command can be executed normally, it cannot be determined that the setting is complete.
    I would like to theoretically judge that it is properly added to php called for web browser access.

  • Answer # 2

    Thank you for your answers.

    After restarting the server (CentOS7), the command was executed again and the installation was successful.

  • Answer # 3

    It seems that php and php72 are mixed.
    When I installed only php72, the command was not found with php -v, and it was output with php72 -v.

    [root @ localhost ~] #
    [root @ localhost ~] # php -v
    -bash: php: command not found
    [root @ localhost ~] #
    [root @ localhost ~] #
    [root @ localhost ~] # php72 -v
    PHP 7.2.25 (cli) (built: Nov 20 2019 18:01:51) (NTS)
    Copyright (c) 1997-2018 The PHP Group
    Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
        with Zend OPcache v7.2.25, Copyright (c) 1999-2018, by Zend Technologies
    [root @ localhost ~] #
    [root @ localhost ~] #
    [root @ localhost ~] # ls -l /etc/opt/remi/php72/php.d
    Total 68
    -rw-r--r--. 1 root root 4892 Nov 21 02:00 10-opcache.ini
    -rw-r--r--. 1 root root 44 Nov 21 02:04 20-bz2.ini
    -rw-r--r--. 1 root root 54 Nov 21 02:04 20-calendar.ini
    -rw-r--r--. 1 root root 48 Nov 21 02:04 20-ctype.ini
    -rw-r--r--. 1 root root 46 Nov 21 02:04 20-curl.ini
    -rw-r--r--. 1 root root 46 Nov 21 02:04 20-exif.ini
    -rw-r--r--. 1 root root 54 Nov 21 02:04 20-fileinfo.ini
    -rw-r--r--. 1 root root 44 Nov 21 02:04 20-ftp.ini
    -rw-r--r--. 1 root root 52 Nov 21 02:04 20-gettext.ini
    -rw-r--r--. 1 root root 48 Nov 21 02:04 20-iconv.ini
    -rw-r--r--. 1 root root 46 Nov 21 02:04 20-json.ini
    -rw-r--r--. 1 root root 46 Nov 21 02:04 20-phar.ini
    -rw-r--r--. 1 root root 52 Nov 21 02:04 20-sockets.ini
    -rw-r--r--. 1 root root 56 Nov 21 02:04 20-tokenizer.ini
    -rw-r--r--. 1 root root 2260 Oct 28 15:06 40-apcu.ini
    -rw-r--r--. 1 root root 645 Nov 21 02:04 opcache-default.blacklist
    [root @ localhost ~] #