配置yum源
追加CentOS 6.5的epel及remi源:
yum install -y epel-release
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
以下是CentOS 7 的源:
yum install -y epel-release
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
使用yum list命令查看可安装的包(Packege):
yum list --enablerepo=remi --enablerepo=remi-php56 | grep php
安装PHP5.6
yum install -y --enablerepo=remi --enablerepo=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
其中php-opcache和php-pecl-apcu模块可提高php执行速度;
验证PHP版本
php -v