1. 概述
本篇博客主要記錄如何在centos7.9升級php版本。
2. 操作過程
添加php的yum源rpm -Uvh https://rpms.remirepo.net/enterprise/remi-release-7.rpm
在/etc/yum.repo.d
目錄下,能夠看到多出很多源
$ ls -lrt remi*
-rw-r--r-- 1 root root 750 2月 15 2022 remi-safe.repo
-rw-r--r-- 1 root root 2605 2月 15 2022 remi.repo
-rw-r--r-- 1 root root 1314 2月 15 2022 remi-php81.repo
-rw-r--r-- 1 root root 1314 2月 15 2022 remi-php80.repo
-rw-r--r-- 1 root root 1314 2月 15 2022 remi-php74.repo
-rw-r--r-- 1 root root 1314 2月 15 2022 remi-php73.repo
-rw-r--r-- 1 root root 1314 2月 15 2022 remi-php72.repo
-rw-r--r-- 1 root root 1314 2月 15 2022 remi-php71.repo
-rw-r--r-- 1 root root 1314 2月 15 2022 remi-php70.repo
-rw-r--r-- 1 root root 456 2月 15 2022 remi-php54.repo
-rw-r--r-- 1 root root 855 2月 15 2022 remi-modular.repo
-rw-r--r-- 1 root root 446 2月 15 2022 remi-glpi94.repo
-rw-r--r-- 1 root root 446 2月 15 2022 remi-glpi93.repo
-rw-r--r-- 1 root root 446 2月 15 2022 remi-glpi92.repo
-rw-r--r-- 1 root root 446 2月 15 2022 remi-glpi91.repo
要安裝或者升級到php7.4,做以下修改vim remi-php74.repo
,把enabled=0
修改爲enabled=1
然後執行yum clean all && yum makecache
安裝httpd服務:yum -y install httpd
安裝php環境:yum -y install php php-mysqlnd php-bcmath php-mbstring php-gd php-png php-jpeg php-gif php-xmlwriter php-xmlreader php-ldap
查看結果
$ rpm -qa|grep php
php-xml-7.4.30-1.el7.remi.x86_64
php-json-7.4.30-1.el7.remi.x86_64
php-mbstring-7.4.30-1.el7.remi.x86_64
php-7.4.30-1.el7.remi.x86_64
php-mysqlnd-7.4.30-1.el7.remi.x86_64
php-ldap-7.4.30-1.el7.remi.x86_64
php-common-7.4.30-1.el7.remi.x86_64
php-pdo-7.4.30-1.el7.remi.x86_64
php-sodium-7.4.30-1.el7.remi.x86_64
oniguruma5php-6.9.8-1.el7.remi.x86_64
php-gd-7.4.30-1.el7.remi.x86_64
php-bcmath-7.4.30-1.el7.remi.x86_64
php-cli-7.4.30-1.el7.remi.x86_64
gd3php-2.3.3-7.el7.remi.x86_64
php-png php-jpeg php-gif這三個似乎沒有