在CentOS 7中更新php,以更新到php7.4为例
piaoling 2024-11-08 11:58:06
第一步:查看已安装的php的所有包
yum list installed | grep php
第二步:卸载上述包
yum remove php*
第三步:换下载源为remi
yum install epel-release
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
第四步:安装php7.4
yum -y install php74-php-devel php74-php.x86_64 php74-php-cli.x86_64 php74-php-common.x86_64 php74-php-gd.x86_64 php74-php-ldap.x86_64 php74-php-mbstring.x86_64 php74-php-mcrypt.x86_64 php74-php-pdo.x86_64 php74-php-mysqlnd php74-php-fpm php74-php-opcache php74-php-pecl-redis php74-php-pecl-mongodb php74-php-xml php74-php-bcmath php74-php-pecl-zip
注:扩展安装格式为php74-php-扩展模块名,缺什么扩展只要按照格式安装相应模块即可
第五步:查看是否安装成功
php74 -v
出现以下表示成功
PHP 7.4.33 (cli) (built: Feb 14 2023 08:49:52) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.33, Copyright (c), by Zend Technologies
第六步:启动php74服务
systemctl start php74-php-fpm
systemctl enable php74-php-fpm #开机启动
完。
————————————————
原文链接:https://blog.csdn.net/WSheng_Pyhon/article/details/130206041
yum list installed | grep php
第二步:卸载上述包
yum remove php*
第三步:换下载源为remi
yum install epel-release
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
第四步:安装php7.4
yum -y install php74-php-devel php74-php.x86_64 php74-php-cli.x86_64 php74-php-common.x86_64 php74-php-gd.x86_64 php74-php-ldap.x86_64 php74-php-mbstring.x86_64 php74-php-mcrypt.x86_64 php74-php-pdo.x86_64 php74-php-mysqlnd php74-php-fpm php74-php-opcache php74-php-pecl-redis php74-php-pecl-mongodb php74-php-xml php74-php-bcmath php74-php-pecl-zip
注:扩展安装格式为php74-php-扩展模块名,缺什么扩展只要按照格式安装相应模块即可
第五步:查看是否安装成功
php74 -v
出现以下表示成功
PHP 7.4.33 (cli) (built: Feb 14 2023 08:49:52) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.33, Copyright (c), by Zend Technologies
第六步:启动php74服务
systemctl start php74-php-fpm
systemctl enable php74-php-fpm #开机启动
完。
————————————————
原文链接:https://blog.csdn.net/WSheng_Pyhon/article/details/130206041
发表评论(评论将通过邮件发给作者):