Centos8将php7.2更新为php7.4

一、卸载php7.2

yum remove php*

需要将centos的yum源更新
二、源报错问题或者yum源不是最新请执行一下命令

Error: Failed to download metadata for repo ‘appstream’: Cannot prepare interna

#进入yum源目录
cd /etc/yum.repos.d

替换yum配置
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*

sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*

#备份yum配置
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_bak

#下载最新yum配置
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo

三、安装remi存储库

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

若报错:

Error:
 Problem: conflicting requests
  - nothing provides redhat-release >= 8.6 needed by remi-release-8.6-1.el8.remi.noarch
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

解决:

rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-8.rpm

wget http://rpms.famillecollet.com/enterprise/remi-release-8.rpm

rpm -ivh remi-release-8.rpm

四、安装EPEL存储库

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

五、安装好EPEL和Remi存储库后,执行以下命令以获取可用PHP模块流的列表

dnf module list php

[e]nabled, [x]disabled, [i]nstalled

如果没有php74更新下源库

dnf update

dnf makecache

六、启用php74模块流

dnf module reset php
dnf module enable php:remi-7.4

七、安装php74

dnf install php php-cli php-common

php -v

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值