centos下用yum升级安装php5.4

查看当前版本的php以安装的扩展:

rpm -qa |grep php*

停止httpd服务

service httpd stop

移除PHP相关

yum remove php*

选择相应的源进行更新

//CentOS/RHEL 7.x:
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

//CentOS/RHEL 6.x
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm

添加完yum源之后就可以直接使用yum命令安装php5.4

yum install php54w

安装PHP相关常用扩展

yum -y install php54w-curl php54w-gd* php54w-pdo* php54w-xmlrpc php54w-xml php54w-mcrypt php54w-fpm php54w-cli php54w-cgi php54w-pear* php54w-mbstring php54w-mysql php54w-devel php54w-pecl-apc php54w-pecl-zendopcache php54w-pecl-memcache php54w-pecl-redis