====== CentOS7安装PHP及PHP扩展 ====== ===== 1、检查当前已安装的PHP包 ===== yum list installed | grep php ===== 2、如果有已安装的PHP包,先删除他们 ===== yum remove php.x86_64 php-cli.x86_64 php-common.x86_64 php-gd.x86_64 php-ldap.x86_64 php-mbstring.x86_64 php-mcrypt.x86_64 php-mysql.x86_64 php-pdo.x86_64 ===== 3、配置CentOS 7.0的yum源 ===== yum install epel-release rpm -ivh [[http://rpms.famillecollet.com/enterprise/remi-release-7.rpm|http://rpms.famillecollet.com/enterprise/remi-release-7.rpm]] ===== 4、使用yum list命令查看可安装的包(Packege) ===== yum list –enablerepo=remi –enablerepo=remi-php56 | grep php ===== 5、安装PHP5.6.x ===== yum install –enablerepo=remi –enablerepo=remi-php56 php php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof ===== 6、查看已安装的PHP版本。 ===== php –version ===== 7、安装php-fpm ===== yum install –enablerepo=remi –enablerepo=remi-php56 php-fpm ===== 8、重新Apache和php启动服务 ===== $ sudo systemctl restart httpd $ sudo systemctl restart php-fpm