centos默认系统安装的是php5.3
[root@sz-local1 scripts]# rpm -qa |grep php
php-pdo-5.3.3-47.el6.x86_64
php-mysql-5.3.3-47.el6.x86_64
php-5.3.3-47.el6.x86_64
php-cli-5.3.3-47.el6.x86_64
php-common-5.3.3-47.el6.x86_64
卸载
rpm -e php-mysql-5.3.3-48.el6_8.x86_64
rpm -e php-bcmath-5.3.3-48.el6_8.x86_64
rpm -e php-5.3.3-48.el6_8.x86_64
rpm -e php-common-5.3.3-48.el6_8.x86_64
rpm -e php-common-* #依赖包过多用yum卸载
yum -y remove php-common-*
安装php5.6.25
rpm -Uvh http://download.Fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
yum install --enablerepo=remi,remi-php56 php php-opcache php-pecl-apcu php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof php-pdo php-pear php-fpm php-cli php-xml php-bcmath php-process php-gd php-common
[root@sz-local1 scripts]# php -v
PHP 5.6.25 (cli) (built: Aug 31 2016 19:26:19)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
with Xdebug v2.4.1, Copyright (c) 2002-2016, by Derick Rethans
ps:有时候会出现phpinfo()打印和php -v显示的不是一个版本,如果是刚更新的要解决这个问题需要重启apache服务即可。
原文地址:http://crfsz.blog.51cto.com/7835882/1851023