默认的版本过低了,手动安装有一些麻烦,想采用Yum安装的能够使用下面的方案:
首先删除旧版本的PHP,
经过yum list installed | grep php能够查看全部已安装的php软件
使用yum remove php ……删除
经过yum list php*查看是否有本身须要安装的版本,若是没有就须要添加第三方yum源, 推荐安装webtatic、rpmforge,还有国内163的php
CentOs 5.x rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.rpm CentOs 6.x rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm CentOs 7.X rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm //rpmforge #32位: wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.i386.rpm rpm -ivh rpmforge-release-0.5.1-1.el5.rf.i386.rpm #64位: wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm rpm -ivh rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm
安装完成后能够使用yum repolist查看已经安装的源,也能够经过ls /etc/yum.repos.d/查看。
nginx
而后再yum install php55w或yum install php54w或yum install php56w||yum install php70w……就能够安装新版本PHP了 web
1.首页安装Webtatic EL6 YUM源centos
rpm -Uvh http://repo.webtatic.com/yum/el6/latest.rpm 服务器
2.中止web服务器php7
service nginx stopphp-fpm
或者ui
service httpd stopspa
3.删除当前的 php 安装 php5.4rest
yum remove php*
yum install php54w
4.重启web服务器
service php-fpm restart
service nginx start
或者
service httpd restart
5.查看php版本
php -v
PHP 5.4.33 (cli) (built: Sep 19 2014 19:58:27)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
参考资料
How to Upgrade PHP 5.3.x to PHP 5.4.x on CentOS
http://www.nginxtips.com/how-to-upgrade-php-5-3-x-to-php-5-4-x-on-centos/
Webtatic EL6的YUM源
https://webtatic.com/packages/php54/
http://stackoverflow.com/questions/11361068/install-php-5-4-1-in-centos6-2