Php

在 CentOS 6.3 上安裝 PHP 5.4.11

  • December 29, 2015

PHP 5.3.3在我的CentOs 6.3伺服器上有,由於這個版本PHP是易受攻擊的,現在嘗試升級到PHP 5.4.11但預設儲存庫CentOs沒有,PHP > 5.3.3所以yum無法檢測到較新的版本。

remi然後我在我的伺服器上安裝了儲存庫

rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

這些命令成功安裝了儲存庫

現在升級PHP的命令

yum --enablerepo=remi,remi-test update httpd mysql mysql-server php php-common 

但它失敗並顯示以下錯誤消息

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again

如果我嘗試yum info php相同的錯誤消息

基本上在安裝這些儲存庫後yum無法正常工作,但 yum 更早工作。

如果我刪除這些儲存庫並嘗試yum它沒有任何錯誤。

我怎樣才能PHP升級到PHP 5.4.11版本?

編輯 @Michael建議我跑了

yum clean all
Loaded plugins: fastestmirror
Cleaning repos: base epel extras updates
Cleaning up Everything
Cleaning up list of fastest mirrors
`[root@www ~]# yum --obsoletes update
Loaded plugins: fastestmirror
Determining fastest mirrors
Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again

還是一樣的錯誤

編輯 2

內容epel.repo

[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

[epel-debuginfo]
name=Extra Packages for Enterprise Linux 6 - $basearch - Debug
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch/debug
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-6&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
gpgcheck=1

[epel-source]
name=Extra Packages for Enterprise Linux 6 - $basearch - Source
#baseurl=http://download.fedoraproject.org/pub/epel/6/SRPMS
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-6&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
gpgcheck=1

網際網路連接執行良好,我檢查過

wget http://google.com

編輯 3

正如@Michael 建議的那樣,我跑了

URLGRABBER_DEBUG=1 yum check-update 最後出現以下錯誤

Problem with the SSL CA cert (path? access rights?)
2013-02-24 20:31:45,730 exception: [Errno 14] PYCURL ERROR 77 - "Problem with the SSL CA cert (path? access rights?)"
INFO:urlgrabber:exception: [Errno 14] PYCURL ERROR 77 - "Problem with the SSL CA cert (path? access rights?)"
2013-02-24 20:31:46,051 retrycode (14) not in list [-1, 2, 4, 5, 6, 7], re-raising
INFO:urlgrabber:retrycode (14) not in list [-1, 2, 4, 5, 6, 7], re-raising
Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again

因此,實際問題在於 SSL 證書,但為什麼它抱怨 SSL 證書,但它是有效的

添加新儲存庫後,請清除 yum 記憶體並更新系統,然後再嘗試安裝更多軟體包。

yum clean all
yum --obsoletes update

根據您更新的資訊,您的本地 CA 證書似乎已損壞或刪除。嘗試重新安裝它們:

yum reinstall ca-certificates

vi epel.repo

更改 https 中

mirrorlist= https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch= $basearch 到 mirrorlist= http://mirrors.fedoraproject.org/metalink?repo=epel-6&arch= $basearch

工作!

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