配置EPEL源

dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm

配置Remi源

dnf install -y https://rpms.remirepo.net/enterprise/remi-release-9.rpm

选择需要安装的版本包

dnf module enable php:remi-8.1

安装PHP 扩展

dnf install php php-cli php-common

查看安装结果

php -v

相关启动php命令

systemctl stop php-fpm.service
systemctl restart php-fpm.service
systemctl start php-fpm.service