Linux系統CentOS使用yum方式安裝指定版本的PHP 添加yum源 從PHP5.3升級到5.4/5.5/5.6

默認的版本過低了,手動安裝有一些麻煩,想採用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

相關文章
相關標籤/搜索