为通过 Remi 的存储库安装的 PHP 安装 php-opcache

时间:2021-06-04 03:03:04

标签: php php-7 opcache

我有一个具有以下设置的环境:

  • Centos/RHEL 8
  • 从 Remi 的存储库安装的 PHP 7.4

我已经像这样设置了已安装的 php:

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

现在我想安装 php-opcache。但是 dnf 报告说似乎没有模块 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

我相当确信这与 repos 的设置方式有关,就像在我的开发环境中一样。

$ 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

这是dnf repolist在问题环境下的输出:

$ 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)

作为旁注,我尝试了 dnf install php-opcache。这发现很好。但它下载了 7.2 版并将 opcache.so 放在与 PHP 寻找模块的位置不同的位置,并且没有 10-opcache.ini 文件。我确实尝试将这些文件手动复制到此 PHP 安装正在查找这些文件的位置,但我收到警告

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

1 个答案:

答案 0 :(得分:1)

显然,从粘贴的 repolist 来看,“remi”存储库未启用。

要正确配置,请遵循 wizard instructions

相关问题