centos7无法安装php-imap扩展



我正在尝试在带有PHP版本7.2.23的CentOS 7服务器上安装imap扩展。我尝试了命令yum install php-imap,输出是

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
epel/x86_64/metalink                                                                                              |  21 kB  00:00:00
* base: mirrors.vangus.co.il
* epel: mirror.de.leaseweb.net
* extras: mirror.ratiokontakt.de
* remi-php72: mirror.23media.com
* remi-safe: mirror.23media.com
* updates: mirror.fra10.de.leaseweb.net
base                                                                                                              | 3.6 kB  00:00:00
epel                                                                                                              | 4.7 kB  00:00:00
extras                                                                                                            | 2.9 kB  00:00:00
mariadb                                                                                                           | 3.4 kB  00:00:00
remi-php72                                                                                                        | 3.0 kB  00:00:00
remi-safe                                                                                                         | 3.0 kB  00:00:00
updates                                                                                                           | 2.9 kB  00:00:00
(1/2): epel/x86_64/updateinfo                                                                                     | 1.0 MB  00:00:00
(2/2): epel/x86_64/primary_db                                                                                     | 6.9 MB  00:00:00
No package php-imap available.
Error: Nothing to do

所以我在谷歌上搜索了一下,发现我们可以从epel存储库进行安装。所以我运行了命令yum list *imap*,我得到了

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.vangus.co.il
* epel: mirror.de.leaseweb.net
* extras: mirror.ratiokontakt.de
* remi-php72: mirror.23media.com
* remi-safe: mirror.23media.com
* updates: mirror.fra10.de.leaseweb.net
Available Packages
cyrus-imapd.x86_64                                              2.4.17-15.el7                                                        base
cyrus-imapd-devel.i686                                          2.4.17-15.el7                                                        base
cyrus-imapd-devel.x86_64                                        2.4.17-15.el7                                                        base
cyrus-imapd-utils.x86_64                                        2.4.17-15.el7                                                        base
imapfilter.x86_64                                               2.6.15-1.el7                                                         epel
imapsync.noarch                                                 1.727-1.el7                                                          epel
imaptest.x86_64                                                 20151005-1.el7                                                       epel
offlineimap.noarch                                              6.7.0-1.el7                                                          epel
perl-Mail-IMAPClient.noarch                                     3.37-1.el7                                                           epel
python-abimap-doc.noarch                                        0.3.1-3.el7                                                          epel
python36-abimap.noarch                                          0.3.1-3.el7                                                          epel
up-imapproxy.x86_64                                             1.2.8-0.12.20171022svn14722.el7                                      epel
uw-imap.x86_64                                                  2007f-16.el7                                                         epel
uw-imap-devel.x86_64                                            2007f-16.el7                                                         epel
uw-imap-static.x86_64                                           2007f-16.el7                                                         epel
uw-imap-utils.x86_64                                            2007f-16.el7                                                         epel

如何为PHP安装imap扩展?请帮忙。

使用正确的配置,根据向导的说明,安装应该可以使用

# dnf install php-imap
Dependencies resolved.
====================================================================================================================================================================================
Package                     Arch                Version                     Repository                 Size
====================================================================================================================================================================================
Installing:
php-imap                    x86_64              7.2.34-4.el7.remi           remi-php72                       89 k
Installing dependencies:
libc-client                 x86_64              2007f-16.el7                epel                                      562 k
Transaction Summary
====================================================================================================================================================================================
Install  2 Packages
Total download size: 651 k
Installed size: 1.7 M
Is this ok [y/N]: 
  • 基地:mirrors.vangus.co.il
  • epel:mirror.de.leaseweb.net
  • 附加:mirror.ratiokont.de
  • remi-hp72:mirror.23media.com
  • remi-safe:mirror.23media.com
  • 更新:mirror.fra10.de.leaseweb.net

嗯。。。看起来不错

包php-imap存在,应在中找到

请检查启用了百胜的插件,或尝试使用--noplugins选项

还请注意,PHP 7.2已于2020年11月到期,因此您应该考虑使用受支持的版本。

取决于您的centos/Locky版本:对于我来说,刚刚在Rocky 9上(安装php 8.0(:

dnf install epel-release
dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm

然后删除任何以前的php安装

dnf remove php*
dnf module reset php
dnf module install php:remi-8.0
dnf install php-imap

让您访问更多的模块,而不仅仅是imap;显然,根据需要添加其他内容。根据您的Distro版本更改rpm URL,例如Centos/Locky 8、Rocky 9等。根据您想要的php版本更改php:remi命令(例如上例中的8.0(。

最新更新