yum 升级 php7.1 到 php7.3

# Upgrade php7.1 to php7.3   1.查看当前版本
php -v

# PHP 7.1.33 (cli) (built: Oct 31 2019 17:36:04) ( NTS )
# Copyright (c) 1997-2018 The PHP Group
# Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
#     with Zend OPcache v7.1.33, Copyright (c) 1999-2018, by Zend Technologies
#     with Xdebug v2.5.5, Copyright (c) 2002-2017, by Derick Rethans

 

2.安装 php7.3 和相关的扩展
yum install -y php73.x86_64 php73-fpm.x86_64

yum install -y \
    php73-bcmath.x86_64 \
    php73-devel.x86_64 \
    php73-gd.x86_64 \
    php73-gmp.x86_64 \
    php73-imap.x86_64 \
    php73-json.x86_64 \
    php73-mbstring.x86_64 \
    php73-mysqlnd.x86_64 \
    php73-opcache.x86_64 \
    php73-pdo.x86_64 \
    php73-process.x86_64 \
    php73-soap.x86_64 \
    php73-xml.x86_64

 

3.修改默认的 php 版本
update-alternatives --set php /usr/bin/php-7.3

 

4.查看 php 版本
php -v

# PHP 7.3.30 (cli) (built: Oct  6 2021 20:34:22) ( NTS )
# Copyright (c) 1997-2018 The PHP Group
# Zend Engine v3.3.30, Copyright (c) 1998-2018 Zend Technologies
#     with Zend OPcache v7.3.30, Copyright (c) 1999-2018, by Zend Technologies

 

5.安装第三方扩展
# 安装 pecl 工具
wget http://pear.php.net/go-pear.phar
php go-pear.phar

yum install -y ImageMagick-devel libmemcached-devel libzstd-devel

pecl install xdebug igbinary imagick memcached redis

# /etc/php-7.3.ini 增加以下内容
zend_extension=/usr/lib64/php/7.3/modules/xdebug.so
extension=igbinary.so
extension=imagick.so
extension=memcached.so
# /etc/php-7.3.d/20-redis.ini  增加以下内容
extension=redis.so

 

6.重启 php-fpm
service restart php-fpm
# systemctl restart php-fpm

 

上一篇:python_paramiko


下一篇:pytest框架与unittest框架的对比