配置EPEL源
bash
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
配置Remi源
bash
dnf install -y https://rpms.remirepo.net/enterprise/remi-release-9.rpm
选择需要安装的版本包
bash
dnf module enable php:remi-8.1
安装PHP 扩展
bash
dnf install php php-cli php-common
查看安装结果
bash
php -v
相关启动php命令
bash
systemctl stop php-fpm.service
systemctl restart php-fpm.service
systemctl start php-fpm.service