在文章中,咱們將展現在centOS系統下如何將php升級到5.6,以前經過yum來安裝lamp環境,直接升級的話,提示沒有更新包,也就是說默認狀況下php5.3.3是最新php
1.查看已經安裝的php版本號bash
鍵入下面代碼:編輯器
1
|
php -v
|
出現下面代碼: ui
1
2
3
|
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
|
好,咱們繼續。this
2.安裝Remi跟EPEL RPM源url
若是你還沒安裝,則輸入如下代碼: spa
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
下載以後:.net
nano /etc/yum.repos.d/remi.repo
而後對裏面內容進行如下修改:code
1
2
3
4
5
6
7
|
[remi]
name=Remi's 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
|
還有如下: blog
1
2
3
4
5
6
7
8
|
[remi-php56]
name=Remi's 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
|
按CTRL+O保存,CTRL+X關閉編輯器
3.如今能夠yum命令直接升級了
輸入如下代碼
1
|
yum -y upgrade php*
|
一旦更新完畢,再次查看php版本號
1
|
php -
v
|
出現如下信息
1
2
3
|
PHP 5.6.14 (cli) (built: Sep 30 2015 14:07:43)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
|
到此,php升級完畢