Linux-使用Remi源安装最新版PHP

Linux :centos7

1.安装Remi源

Remi依赖于EPEL源,因此首先要安装EPEL(EPEL几乎是必不可少的yum/dnf源,许多发行版其实已经内置):

yum install -y epel-release # CentOS 8用户可以使用dnf安装

接着安装Remi源。Remi源在全球有许多镜像,国内推荐使用清华大学的镜像源安装(官网首页列出了许多源,清华源是国内镜像源代表):

# CentOS 8安装
yum install https://mirrors.tuna.tsinghua.edu.cn/remi/enterprise/remi-release-8.rpm
# CentOS 7安装
yum install https://mirrors.tuna.tsinghua.edu.cn/remi/enterprise/remi-release-7.rpm

此外建议安装 yum-utils 包,提供启用、禁用源等实用功能:

yum install yum-utils

2.安装php8版本

yum-config-manager --disable 'remi-php*'
yum-config-manager --enable   remi-php80
yum clean all
yum install php php-fpm php-cli # 等一些额外PHP模块

3.查看是否安装成功

php -v

4.启动php服务

systemctl start php-fpm
//查看服务状态
systemctl status php-fpm

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注