一、备份
- 快照、镜像
- 配置文件(没有定制就算)
二、安装 remi repository
English : Repository Configuration - Remi's RPM repository - Blog (remirepo.net)
先安装 EPEL 仓库,再安装 REMI 仓库。
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
wget https://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm
rpm -qa | grep php > php_rpm.txt
yum remove "php*" -y
yum install -y http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum repolist remi-safe
yum --disablerepo=remi-php7x --enablerepo=remi-php74 install php php-pdo php-fpm php-gd php-mbstring php-mysql php-curl php-mcrypt php-json -y
三、升级 PHP
- 确认当前已经安装的包,卸载
[sysadmin@VM_201_16_centos yum.repos.d]$ rpm -qa |grep php
php-common-5.4.16-45.el7.x86_64
php-mbstring-5.4.16-45.el7.x86_64
php-bcmath-5.4.16-45.el7.x86_64
php-ldap-5.4.16-45.el7.x86_64
php-pdo-5.4.16-45.el7.x86_64
php-xml-5.4.16-45.el7.x86_64
php-gd-5.4.16-45.el7.x86_64
php-cli-5.4.16-45.el7.x86_64
php-mysql-5.4.16-45.el7.x86_64
php-5.4.16-45.el7.x86_64
卸载
sudo yum remove php*
2.升级
sudo yum install php74-php php74-php-common php74-php-mbstring php74-php-bcmath php74-php-ldap php74-php-pdo php74-php-xml php74-php-gd php74-php-cli php74-php-mysql
- 检查升级结果
[sysadmin@VM_201_16_centos ~]$ php74 -v
PHP 7.4.24 (cli) (built: Sep 21 2021 11:23:11) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
网友评论