网上一大堆不算太靠谱的教程
sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo dnf -y install https://rpms.remirepo.net/enterprise/remi-release-8.rpm
执行安装remi库的时候报错:
remi-release-8.rpm 32 kB/s | 32 kB 00:00
Error:
Problem: conflicting requests
- nothing provides (redhat-release >= 8.8 or centos-stream-release >= 8) needed by remi-release-8.8-1.el8.remi.noarch
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
此时执行:
sudo dnf -y install centos-release-stream
即可解决remi安装缺失的依赖
再执行
sudo dnf -y install https://rpms.remirepo.net/enterprise/remi-release-8.rpm
即可解决remi库安装失败问题
执行下面命令查询可安装的php版本
dnf module list php
Repository extras is listed more than once in the configuration
Repository base is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository PowerTools is listed more than once in the configuration
Repository AppStream is listed more than once in the configuration
Last metadata expiration check: 0:01:09 ago on Fri 27 Oct 2023 12:05:36 PM CST.
CentOS-8 - AppStream - mirrors.aliyun.com
Name Stream Profiles Summary
php 7.2 [d] common [d], devel, minimal PHP scripting language
php 7.3 common [d], devel, minimal PHP scripting language
php 7.4 common [d], devel, minimal PHP scripting language
CentOS Linux 8 - AppStream
Name Stream Profiles Summary
php 7.2 [d] common [d], devel, minimal PHP scripting language
php 7.3 common [d], devel, minimal PHP scripting language
php 7.4 common [d], devel, minimal PHP scripting language
Remi's Modular repository for Enterprise Linux 8 - x86_64
Name Stream Profiles Summary
php remi-7.2 common [d], devel, minimal PHP scripting language
php remi-7.3 common [d], devel, minimal PHP scripting language
php remi-7.4 common [d], devel, minimal PHP scripting language
php remi-8.0 common [d], devel, minimal PHP scripting language
php remi-8.1 common [d], devel, minimal PHP scripting language
php remi-8.2 common [d], devel, minimal PHP scripting language
php remi-8.3 common [d], devel,
minimal PHP scripting language
顺带解决另一个报错,由于已安装php7和php8.1,执行删除其它版本的时候报错:
dnf remove php*
Repository base is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository PowerTools is listed more than once in the configuration
Repository AppStream is listed more than once in the configuration
Error:
Problem: package php-7.2.24-1.module_el8.2.0+313+b04d0a66.x86_64 requires php-cli(x86-64) = 7.2.24-1.module_el8.2.0+313+b04d0a66, but none of the providers can be installed
- conflicting requests
- problem with installed package php-7.2.24-1.module_el8.2.0+313+b04d0a66.x86_64
使用yum remove php*也是同样的错误,使用它参考的建议加参数也不行,最后直接执行rpm -e成功删除该package
再次安装Php83
dnf module install php:remi-8.3 -y
#启动服务
systemctl enable php-fpm.service --now
#查看php服务
systemctl status php-fpm.service
最后查看php版本
php -v
PHP 8.3.0RC5 (cli) (built: Oct 24 2023 11:44:58) (NTS gcc x86_64)
Copyright (c) The PHP Group
Zend Engine v4.3.0RC5, Copyright (c) Zend Technologies
搞定
————————————————
版权声明:本文为CSDN博主「tomjk」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/tomjk/article/details/134073569