centos7更新php

 admin   2022-05-19 15:21   263 人阅读  0 条评论

默认的yum源无法升级PHP,需要添加第三方yum源,我们选择webtatic库

CentOs 5.x

rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.rpm

CentOs 6.x

rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm

CentOs 7.X

rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

我们以php7.2为例:

正式安装php7.2:


1.查看yum源是否有php7.2安装包

yum list php72

2.安装php及相关插件


yum install php71w-cli php71w-common php71w-devel php71w-embedded php71w-fpm php71w-gd php71w-mbstring php71w-mysqlnd php71w-opcache php71w-pdo php71w-xml php71w php71w-bcmath php71w-dba php71w-enchant php71w-imap php71w-interbase php71w-intl php71w-ldap php71w-mcrypt php71w-odbc php71w-pdo_dblib php71w-pear php71w-pecl-apcu php71w-pecl-imagick php71w-pecl-xdebug php71w-pgsql php71w-phpdbg php71w-process php71w-pspell php71w-recode php71w-snmp php71w-soap php71w-tidy php71w-xmlrpc php71w-pecl-igbinary php71w-intl php71w-memcached php71w-pecl-mongodb



其他版本php安装

如果想安装php7.0或者7.1版本,将上面的php72w替换为php70w或者php71w就可以了。

安装php扩展根据自己需求来

php72w-cli

php72w-common

php72w-devel

php72w-embedded

php72w-fpm

php72w-gd

php72w-mbstring

php72w-mysqlnd

php72w-opcache

php72w-pdo

php72w-xml

php72w

php72w-bcmath

php72w-dba

php72w-enchant

php72w-imap

php72w-interbase

php72w-intl

php72w-ldap  

php72w-mcrypt

php72w-odbc

php72w-pdo_dblib

php72w-pear

php72w-pecl-apcu

php72w-pecl-imagick

php72w-pecl-xdebug

php72w-pgsql

php72w-phpdbg

php72w-process

php72w-pspell

php72w-recode

php72w-snmp

php72w-soap

php72w-tidy

php72w-xmlrpc

php72w-pecl-igbinary

php72w-intl

php72w-memcached

php72w-pecl-mongodb

推荐用 php72w-mysqlnd 替代 php72w-mysql

3.查看当前php版本

php -v
-----------------------------------
CentOS 7 升级Php版本 5.6 -> 7.2
https://blog.51cto.com/u_15482433/4926302

本文地址:https://liuchunjie.top/?id=340
版权声明:本文为原创文章,版权归 admin 所有,欢迎分享本文,转载请保留出处!

 发表评论


表情

还没有留言,还不快点抢沙发?