微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

debian – PHP抛出错误版本与MySQL插件不匹配

在这里使用Debian Jessie,我有几个PHP页面显示错误

A PHP Error was encountered
Severity: Warning

Message: MysqLi::real_connect(): Headers and client library minor version mismatch. Headers:50553 Library:50630

Filename: MysqLi/MysqLi_driver.PHP

PHP5包是5.6.30 dfsg-0 deb8u1.
PHP5-MysqL包是5.6.30 dfsg-0 deb8u1.

两者都是标准的Debian软件包,我没有手工编译组件的任何部分.

我尝试了更新和升级,重新安装PHP5-MysqL,并重新启动Apache,但它没有解决问题.

PHPinfo()也抱怨PHP5-MysqL中的版本不匹配.

该怎么办?

解决方法:

这似乎是一个包装PHP5-MysqL的bug;我在这文章Headers and client library minor version mismatch中找到了一个相关的问题.

虽然不是公认的答案,但该链接中最相关的答案是:

For new MysqL 5.6 family you need to install PHP5-MysqLnd, not
PHP5-MysqL.

Remove this version of the MysqL driver

sudo apt-get remove PHP5-MysqL And install this instead

sudo apt-get install PHP5-MysqLnd

但是,为了保持依赖关系的一致性,卸载PHP5-MysqL并不是最好的想法;做得好得多:

sudo apt-get install PHP5-MysqLnd

并且在安装PHP5-MysqLnd时让依赖项卸载PHP5-MysqL.

来自packages.debian.org:Package: php5-mysqlnd

MysqL module for PHP5 (Native Driver)

This package provides modules for MysqL database connections directly
from PHP scripts. It includes the generic “MysqL” module which can be
used to connect to all versions of MysqL, an improved “MysqLi” module
for MysqL version 4.1 or later, and the pdo_MysqL module for use with
the PHP Data Object extension.

在做了sudo apt-get install PHP5-MysqLnd之后,有问题的页面开始正常工作,没有发出警告.

然而,仍在使用latin1 / iso-8859-1的另一个页面中的其他遗留页面开始显示有趣的字母,例如被迫使用UTF-8,所以我们不得不在该服务器上回滚到PHP5-MysqL.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐