CentOS8安装PHP83

文章讲述了在CentOS8系统中遇到remi库安装错误,通过卸载冲突包并重新安装remi-repository和选择合适的PHP版本来解决问题的过程。

网上一大堆不算太靠谱的教程

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

搞定

 

评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

tomjk

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值