一、安装准备

使用以下命令将yum仓库包升级更换成PHP7的rpm包

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm


二、开始安装

  1. 先使用yum命令安装基本PHP组件,以后要用到啥再安装啥


yum -y install php70w.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64 php70w-mysql.x86_64 php70w-pdo.x86_64


2.再安装PHP-fpm(进程管理器,提供PHP进程管理方式,可以有效控制内存和进程、平滑重载PHP配置)

yum -y install php70w-fpm php70w-opcache


3.安装完之后启动php-fpm

systemctl start php-fpm   [service php-fpm start]
systemctl enable php-fpm  [chkconfig php-fpm on]

 

4.查看版本以检测是否安装成功

php -v