1.安装epel:
#yum list installed | grep php
#查看已安装的PHP,查到后rpm -e 卸载
#yum repolist all | grep php
yum install epel-release -y
2.安装REMI源:
rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/remi/enterprise/remi-release-7.rpm
3.查看可以安装的PHP版本:
yum repolist all | grep php
4.设置默认安装的版本:
yum-config-manager --enable remi-php74若提示:-bash: yum-config-manager: 未找到命令
表明未安装yum-utlis包,yum -y install yum-utils 即可
5.安装PHP:
yum -y install php
#查看PHP版本
php -v
#查看已安装的模块
php -m
6.查看哪些可以安装的PHP扩展:
yum search php74-php
7.安装PHP扩展:
示例:安装php74-php-fpm扩展,则执行:(不用加php74-)
yum -y install php-fpm
8.php-fpm命令:
# 启动
systemctl start php-fpm
# 停止
systemctl stop php-fpm
#重启
systemctl restart php-fmp
# 重载
systemctl reload php-fpm
#设置开机启动
systemctl enable php-fpm
#禁止开机启动
systemctl disable php-pfm
原文:https://www.cnblogs.com/itwlp/p/12004150.html