CentOS 7无法安装php-imap扩展

xriantvc  于 2023-02-07  发布在  PHP
关注(0)|答案(2)|浏览(120)

我正在使用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

如何安装imap扩展的PHP?请帮助。

e5nszbig

e5nszbig1#

根据wizard说明,使用正确的配置,安装应该可以正常工作

# 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]:
  • 数据库:www.example.commirrors.vangus.co.il
  • 电子邮件:www.example.commirror.de.leaseweb.net
  • 其他内容:www.example.commirror.ratiokontakt.de
  • 网址:www.example.commirror.23media.com
  • 远程安全:www.example.commirror.23media.com
  • 更新:www.example.commirror.fra10.de.leaseweb.net

嗯......看起来不错
php-imap存在,应该可以找到
请检查启用了yum的插件,或尝试使用--noplugins选项
请注意PHP 7.2已于2020年11月到期,因此您应考虑使用supported version

67up9zun

67up9zun2#

取决于您的centos/Rocky版本:对于我刚才在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/Rocky 8,Rocky 9等。根据您想要的php版本(例如上面示例中的8. 0)更改php:remi命令。

相关问题