首先查找系统中已有的版本
(推荐教程:php图文教程)
yum list installed | grep php
如果存在已有的php版本 ,执行下面的命令删除
yum -y remove php-common
然后以centos6系统为例,添加centos 6.x的yum源
(视频教程推荐:php视频教程)
rpm -uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpmrpm -uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
最后使用yum命令安装 php,安装5.6版本为remi-php56,安装5.5版本为remi-php55
yum install -y --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-commo
以上就是centos下如何安装php5.6的详细内容。
