1.因为安装php7需要2个额外的源,epel和webtatic,所以都要安装一下。
yum install epel-release -y
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
2.清除历史版本避免错误
yum -y remove php*
3.安装php7
yum -y install php72w php72w-cli php72w-fpm php72w-common php72w-devel
yum -y install php72w php72w-cli php72w-fpm php72w-common php72w-devel php72w-embedded php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml
4.安装完启动服务
systemctl enable php-fpm.service
systemctl start php-fpm.service