安装步骤
- 如果已经安装PHP,执行如下命令卸载
yum -y remove php*
- 由于linux的yum源不存在php7.x,所以我们要更改yum源
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
# 或者
yum install epel-release -y
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
- 查看PHP7.2版本
yum list | grep php72
- yum 安装php72w和各种拓展,根据自己需要安装
#yum install php72w php71w-cli php72w-common php72w-devel php72w-embedded php72w-fpm php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml
- 检查安装结果
php -v