将yum源更换为aliyun的remi

yum -y install https://mirrors.aliyun.com/remi/enterprise/remi-release-7.rpm
yum -y install yum-utils

下面演示安装PHP8
首先查询PHP的包

yum repolist all |grep php

请输入图片描述

安装PHP80

yum-config-manager --enable remi-php80
 sudo yum install  php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mbstring php-curl php-xml php-pear php-bcmath php-json php-redis  --skip-broken

查看PHP版本

php -v