码迷,mamicode.com
首页 > Web开发 > 详细

CentOS 通过yum来升级php到php5.6

时间:2017-04-15 14:09:26      阅读:374      评论:0      收藏:0      [点我收藏+]

标签:pre   ase   find   3.0   htm   环境   .com   too   nsf   

 

1.查看已经安装的php版本号

键入下面代码:

php -v
或者
/usr/bin/php

出现下面代码: 

PHP 5.3.3 (cli) (built: Jul 9 2015 17:39:00)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

 

2.安装Remi跟EPEL RPM源

下载并安装,代码如下: 

wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm && rpm -Uvh epel-release-latest-6.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm && rpm -Uvh remi-release-6*.rpm

 

下载之后:

vim /etc/yum.repos.d/remi.repo

 

然后对里面内容进行以下修改:

[remi]
name=Remis RPM repository for Enterprise Linux 6 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/6/remi/$basearch/
mirrorlist=http://rpms.remirepo.net/enterprise/6/remi/mirror
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

 

还有以下:

[remi-php56]
name=Remis PHP 5.6 RPM repository for Enterprise Linux 6 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/6/php56/$basearch/
mirrorlist=http://rpms.remirepo.net/enterprise/6/php56/mirror
# WARNING: If you enable this repository, you must also enable "remi"
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

 

3.现在可以yum命令直接升级了

 输入以下代码

yum -y upgrade php*
大概是镜像问题。我得到了报错

Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://rpms.remirepo.net/enterprise/6/php55/mirror error was
12: Timeout on http://rpms.remirepo.net/enterprise/6/php55/mirror: (28, ‘Operation too slow. Less than 1 bytes/sec transfered the last 30 seconds‘)
错误:Cannot find a valid baseurl for repo: remi-php55

 

然后我yum update -y php*就好了    -_-无奈!

 

一旦更新完毕,再次查看php版本号 

php -v

 

出现以下信息 

 
PHP 5.6.30 (cli) (built: Jan 19 2017 08:09:42) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

 

 到此,php升级完毕

 

ref:http://www.cnblogs.com/insoleis/articles/5587630.html

CentOS 通过yum来升级php到php5.6

标签:pre   ase   find   3.0   htm   环境   .com   too   nsf   

原文地址:http://www.cnblogs.com/irockcode/p/6713678.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!