Centos6

在 centos 6 上安裝 php 7.3 的 php 擴展

  • May 18, 2020

我用過,

yum install php-pecl-zip

我收到以下錯誤,

Loaded plugins: fastestmirror, replace
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: centos.mirror.snu.edu.in
* epel: epel.dionipe.id
* extras: centos.mirror.snu.edu.in
* updates: centos.mirror.snu.edu.in
* webtatic: uk.repo.webtatic.com
http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/repodata/repomd.xml: [Errno 14] Downloaded more than max size for https://www.mongodb.com/: 113752 > 102400
Trying other mirror.
Resolving Dependencies
--> Running transaction check
---> Package php71w-common.x86_64 0:7.1.33-1.w6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================
Package                                    Arch                                Version                                     Repository                             Size
========================================================================================================================================================================
Installing:
php71w-common                              x86_64                              7.1.33-1.w6                                 webtatic                              1.2 M

Transaction Summary
========================================================================================================================================================================
Install       1 Package(s)

Total size: 1.2 M
Installed size: 8.5 M

Transaction Check Error:
     file /etc/php.ini from install of php71w-common-7.1.33-1.w6.x86_64 conflicts with file from package php-common-7.3.12-1.el6.remi.x86_64
     file /usr/lib64/php-zts/modules/bz2.so from install of php71w-common-7.1.33-1.w6.x86_64 conflicts with file from package php-common-7.3.12-1.el6.remi.x86_64
     file /usr/lib64/php/modules/bz2.so from install of php71w-common-7.1.33-1.w6.x86_64 conflicts with file from package php-common-7.3.12-1.el6.remi.x86_64
     file /usr/lib64/php-zts/modules/calendar.so from install of php71w-common-7.1.33-1.w6.x86_64 conflicts with file from package php-common-7.3.12-1.el6.remi.x86_64
     file /usr/lib64/php/modules/calendar.so from install of php71w-common-7.1.33-1.w6.x86_64 conflicts with file from package php-common-7.3.12-1.el6.remi.x86_64
     file /usr/lib64/php-zts/modules/ctype.so from install of php71w-common-7.1.33-1.w6.x86_64 conflicts with file from package php-common-7.3.12-1.el6.remi.x86_64
     file /usr/lib64/php/modules/ctype.so from install of php71w-common-7.1.33-1.w6.x86_64 conflicts with file from package php-common-7.3.12-1.el6.remi.x86_64

我的PHP版本php -v如下,

PHP 7.3.12 (cli) (built: Nov 19 2019 12:37:39) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.12, Copyright (c) 1998-2018 Zend Technologies

epel repo如下,

Installed:
 epel-release.noarch 0:6-8

安裝 php-zip 擴展時我的伺服器有什麼問題?

以下命令解決了我的問題。

sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm

sudo yum -y install https://rpms.remirepo.net/enterprise/remi-release-6.rpm

sudo yum -y install yum-utils

sudo yum-config-manager --enable remi-php73

sudo yum update

sudo yum install php-pecl-zip

php --modules

service httpd restart

引用自:https://serverfault.com/questions/1017583