CentOS7下升级PHP : Requires: libgmp.so.3()(64bit)

本文介绍了在CentOS7中升级PHP时遇到的libgmp.so.3依赖问题,以及如何通过安装compat-libgmp解决。此外,还讲述了在升级后PHP的mysql_connect不工作的问题,提供了通过安装pecl-database-mysql扩展来解决的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

yum  list "php*"

yum  install  php71w

CentOS7下升级PHP碰到的问题:

Resolving Dependencies

--> Running transaction check
---> Package php71w-common.x86_64 0:7.1.14-1.w6 will be installed
--> Processing Dependency: libgmp.so.3()(64bit) for package: php71w-common-7.1.14-1.w6.x86_64
--> Processing Conflict: php71w-common-7.1.14-1.w6.x86_64 conflicts php-common < 7.1
--> Finished Dependency Resolution
Error: php71w-common conflicts with php-common-5.4.16-43.el7_4.1.x86_64
Error: Package: php71w-common-7.1.14-1.w6.x86_64 (webtatic)
           Requires: libgmp.so.3()(64bit)
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest


这个问题百度里找不到解决办法, 源码编译  gmp-4.3.1-12.el6.i686.rpm 生成了 libgmp.so.3 库也不行。

最后翻墙上了google, 一下就找到解决办法了。


下载安装    compat-libgmp-4.3.1-1.sl7.x86_64.rpm

继续安装又碰到问题:

Error: php70w-common conflicts with php-common-5.4.16-43.el7_4.1.x86_64
Error: Package: php70w-7.0.27-1.w6.x86_64 (webtatic)
           Requires: httpd-mmn = 20051115
           Installed: httpd-2.4.6-67.el7.centos.6.x86_64 (@updates)
               httpd-mmn = 20120211
               httpd-mmn = 20120211x8664
               httpd-mmn = 20120211-x86-64
           Available: httpd-2.4.6-67.el7.centos.x86_64 (base)
               httpd-mmn = 20120211x8664
               httpd-mmn = 20120211-x86-64
               httpd-mmn = 20120211
           Available: httpd-2.4.6-67.el7.centos.2.x86_64 (updates)
               httpd-mmn = 20120211x8664
               httpd-mmn = 20120211-x86-64
               httpd-mmn = 20120211
           Available: httpd-2.4.6-67.el7.centos.5.x86_64 (updates)
               httpd-mmn = 20120211x8664
               httpd-mmn = 20120211-x86-64
               httpd-mmn = 20120211
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest


解决方案 清理   yum clean all

以为下来就可以愉快的玩耍了,然而 php 的 mysql_connect 竟然用不成,google了一下, 是PHP的MySQL扩展被从php中移除了。

解决办法有两个, 一个是从源码编译安装PHP,这个太费事了,要编译半天。

另外就是单独安装php扩展。

git clone https://github.com/php/pecl-database-mysql.git

或者下面地址下载 :

http://git.php.net/?p=pecl/database/mysql.git;a=summary


yum install php70w-devel

找到phpize的路径  : /usr/bin/phpize 执行如下命令

cd  ./pecl-database-mysql

/usr/bin/phpize

 ./configure --with-php-config=/usr/bin/php-config  --with-mysql=mysqlnd

make  & make  install

重启php-fpm

/bin/systemctl restart php-fpm.service




评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

langeldep

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值