1、首先安装 EPEL 源:
yum install epel-release -y
EPEL是一个比官方rpm包更丰富、版本相对更高的额外第三方源。
2、安装对应的 REMI 源:
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
除了EPEL源之外还有REMI的源。它包含最新版本 PHP 和 MySQL 包
3、安装 Yum 源管理工具:
yum install yum-utils -y
4、安装php74及常用扩展:
yum --enablerepo=remi-php74 install php -y
yum --enablerepo=remi-php74 install php-gmp php-zip php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt php-devel php-mysql php-gd php-bcmath php-pdo php-pecl-imagick php-fpm php-curl php-devel php-pear php-intl php-sodium -y
卸载命令:
yum --enablerepo=remi-php74 remove php*
6、开启 php 服务命令:
systemctl start php-fpm
或
service php-fpm start
7、加入开机自启动
systemctl enable php-fpm
8、查看php版本:
php -v