<p>在文章中,我们将展示在centOS系统下如何将php升级到5.6,之前通过yum来安装lamp环境,直接升级的话,提示没有更新包,也就是说默认情况下php5.3.3是最新</p><p>1.查看已经安装的php版本号</p><p>键入下面代码:</p><pre class="brush:bash;toolbar:false">php-v</pre><p>出现下面代码:</p><pre class="brush:bash;toolbar:false">PHP5.3.3(cli)(built:Jul9201517:39:00)
Copyright(c)1997-2010ThePHPGroup
ZendEnginev2.3.0,Copyright(c)1998-2010ZendTechnologies</pre><p>好,我们继续。</p><p></p><p>2.安装Remi跟EPEL RPM源</p><p>如果你还没安装,则输入以下代码:</p><pre class="brush:php;toolbar:false">wgethttps://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm&&rpm-Uvhepel-release-latest-6.noarch.rpm
wgethttp://rpms.famillecollet.com/enterprise/remi-release-6.rpm&&rpm-Uvhremi-release-6*.rpm</pre><p><br/></p><p>下载之后:</p><p>nano /etc/yum.repos.d/remi.repo</p><p></p><p>然后对里面内容进行以下修改:</p><pre class="brush:bash;toolbar:false">[remi]
name=Remi'sRPMrepositoryforEnterpriseLinux6-$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</pre><p></p><p>还有以下:</p><pre class="brush:bash;toolbar:false">[remi-php56]
name=Remi'sPHP5.6RPMrepositoryforEnterpriseLinux6-$basearch
#baseurl=http://rpms.remirepo.net/enterprise/6/php56/$basearch/
mirrorlist=http://rpms.remirepo.net/enterprise/6/php56/mirror
#WARNING:Ifyouenablethisrepository,youmustalsoenable"remi"
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi</pre><p>按CTRL+O保存,CTRL+X关闭编辑器 </p><p></p><p>3.现在可以yum命令直接升级了</p><p>输入以下代码</p><pre class="brush:bash;toolbar:false">yum-yupgradephp*</pre><p></p><p>一旦更新完毕,再次查看php版本号</p><p>php -v</p><p>出现以下信息</p><pre class="brush:bash;toolbar:false">PHP5.6.14(cli)(built:Sep30201514:07:43)
Copyright(c)1997-2015ThePHPGroup
ZendEnginev2.6.0,Copyright(c)1998-2015ZendTechnologies</pre><p> </p><p>到此,php升级完毕</p>