Skip to content
Advertisement

Install php-opcache for PHP installed via Remi’s repository

I have an environment with the following setup:

  • Centos/RHEL 8
  • PHP 7.4 installed from Remi’s repository

I have set installed php like so:

sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo dnf -y install http://rpms.remirepo.net/enterprise/remi-release-8.rpm 

sudo dnf -y install php74 php74-php-common php74-php-devel php74-php-cli php74-php-fpm

Now I want to install php-opcache. However dnf is reporting that there doesn’t appear to be a module php74-php-opcache.

$ sudo dnf install php74-php-opcache

Updating Subscription Management repositories.
Last metadata expiration check: 0:56:51 ago on Fri 04 Jun 2021 13:52:35 NZST.
No match for argument: php74-php-opcache
Error: Unable to find a match: php74-php-opcache

I’m fairly convinced this has something to do with how repos are set up, as on my dev environment, it works.

$ sudo dnf -y install php74-php-opcache
Last metadata expiration check: 0:11:18 ago on Fri 04 Jun 2021 02:36:41 PM NZST.
Dependencies resolved.
==================================================================================================================================================================================================================================
 Package                                                    Architecture                                    Version                                                      Repository                                          Size
==================================================================================================================================================================================================================================
Installing:
 php74-php-opcache                                          x86_64                                          7.4.20-1.el8.remi                                            remi-safe                                          274 k

Here is the output of dnf repolist on the problem environment:

$ sudo dnf repolist
Updating Subscription Management repositories.
repo id                                                                                                repo name
epel                                                                                                   Extra Packages for Enterprise Linux 8 - x86_64
epel-modular                                                                                           Extra Packages for Enterprise Linux Modular 8 - x86_64
mod-pagespeed                                                                                          mod-pagespeed
pgdg-common                                                                                            PostgreSQL common RPMs for RHEL/CentOS 8 - x86_64
pgdg12                                                                                                 PostgreSQL 12 for RHEL/CentOS 8 - x86_64
remi-modular                                                                                           Remi's Modular repository for Enterprise Linux 8 - x86_64
rhel-8-for-x86_64-appstream-rpms                                                                       Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs)
rhel-8-for-x86_64-baseos-rpms                                                                          Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs)

As a sidenote, I have tried dnf install php-opcache. This is found fine. But it downloads version 7.2 and puts the opcache.so in a different location to where PHP is looking for modules and no 10-opcache.ini file. I did try manually copy these file to where this installation of PHP is looking for those files, but I got a warning

/opt/remi/php74/root/usr/lib64/php/modules/opcache.so: undefined symbol: _zval_ptr_dtor

Advertisement

Answer

Obviously, from the pasted repolist, “remi” repository is not enabled.

For a proper configuration, follow the wizard instructions

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement