页眉和客户端库次版本不匹配页眉和客户端库次版本不匹配(Headers and client libr

2019-05-14 13:41发布

在PHP中,我发现了以下警告每当我试图连接到一个数据库(通过mysql_connect

警告:mysql_connect()函数:页眉和客户端库次版本不匹配。 头:50162图书馆:50524

在我php -i输出我下的mysqli列出的以下值

客户端API库版本=> 5.5.24

客户端API头版本=> 62年5月1日

我试着更新PHP5,MySQL PHP的,但我在他们两人的最新版本是已。 我如何去更新头版本,所以我再看到这样的警告?

编辑

我的MySQL文件都应该被更新为最新版本:

$ apt-get install mysql.*5.5
. . .
mysql-client-5.5 is already the newest version.
mysql-server-core-5.5 is already the newest version.
mysql-server-5.5 is already the newest version.
mysql-testsuite-5.5 is already the newest version.
mysql-source-5.5 is already the newest version.

删除旧版本

$ apt-get remove mysql.*5.1
. . .
Package handlersocket-mysql-5.1 is not installed, so not removed
Package mysql-cluster-client-5.1 is not installed, so not removed
Package mysql-cluster-server-5.1 is not installed, so not removed
Package mysql-client-5.1 is not installed, so not removed
Package mysql-client-core-5.1 is not installed, so not removed
Package mysql-server-5.1 is not installed, so not removed
Package mysql-server-core-5.1 is not installed, so not removed
Package mysql-source-5.1 is not installed, so not removed

Answer 1:

你的PHP编译与MySQL 5.1,但现在它是连接5.5.X系列的MySQL库。 你必须PHP升级到与MySQL 5.5编译版本或恢复MySQL客户端库5.1.x.



Answer 2:

我使用MariaDB的,并有类似的问题。

从MariaDB的网站 ,建议通过解决它

  1. 切换到使用在PHP中mysqlnd驱动程序(推荐解决方案)。
  2. 以较低的错误报告级别运行:

     $err_level = error_reporting(0); $conn = mysql_connect('params'); error_reporting($err_level); 
  3. 重新编译PHP与MariaDB的客户端库。
  4. 与MariaDB的使用你原来的MySQL客户端库。

我的问题固定使用在Ubuntu的mysqlnd驱动程序:

sudo apt-get install php5-mysqlnd

干杯!


[更新:额外的信息]安装此驱动程序还解决返回整数值作为字符串PDO问题。 为确保类型为整数,安装mysqlInd后,做到这一点

$db = new PDO('mysql:host='.$host.';dbname='.$db_name, $user, $pass, 
          array( PDO::ATTR_PERSISTENT => true));
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);


Answer 3:

对于新的MySQL 5.6系列,您需要安装PHP5-mysqlnd,不是PHP5-MySQL的。

删除此版本的MySQL驱动程序的

sudo apt-get remove php5-mysql

并安装这个代替

sudo apt-get install php5-mysqlnd


Answer 4:

MySQL的同一作品:

sudo apt-get install php5-mysqlnd

我读过这个线程试图找到MySQL的解决方案,而且我也看到了肯的答案,但我忽略了解决方案,MariaDB的,浪费了这样几个小时。 目前尚不清楚对我来说,同样可以申请到MySQL。 这个帖子只是为了饶了你几个小时我输了。



Answer 5:

根原因错误是由PHP与MySQL客户端库前段时间分离本身。 所以,发生了什么(主要是在Linux上的较旧的编译)是人们将编译PHP对MySQL客户端的一个特定的build(指安装了MySQL的版本是不相关的),而不是升级(在CentOS的这个包被列为mysqlclientXX ,其中XX表示包数)。 这也让软件包的维护者,以支持低版本的MySQL。 这是做一个混乱的方式,但它是给出PHP和MySQL如何使用不同的许可的唯一途径。

MySQLND解决了使用PHP的自己的本地驱动程序(ND),它不再依赖于与MySQL客户端的问题。 它也编译PHP的版本,您正在使用。 这是一个更好的解决方案周围的一切,如果没有其他原因,MySQLND制成具有PHP与MySQL。

如果您无法安装MySQLND你其实可以忽略这个错误在大多数情况下。 这只是更大的FYI通知比什么的。 它听起来很吓人。



Answer 6:

从源代码编译PHP和MySQL的本地驱动程序(mysqlnd) ,

cd /php/source/path
./configure <other-options> --with-mysql --with-mysqli --with-pdo-mysql
make clean    # required if there was a previous make, which could cause various errors during make
make
make install

/php/source/path/configure --help

--with-mysql=DIR        Include MySQL support.  DIR is the MySQL base
                      directory, if no DIR is passed or the value is
                      mysqlnd the MySQL native driver will be used
--with-mysqli=FILE      Include MySQLi support.  FILE is the path
                      to mysql_config.  If no value or mysqlnd is passed
                      as FILE, the MySQL native driver will be used
--with-pdo-mysql=DIR    PDO: MySQL support. DIR is the MySQL base directory
                      If no value or mysqlnd is passed as DIR, the
                      MySQL native driver will be used

一个或多个PHP的MySQL扩展可以通过使用这些选项包括在内。
如果值不传递给这些选项,或者如果该值mysqlnd ,MySQL的本地驱动程序将被使用。



Answer 7:

我得到了相同的PHP在我的WordPress网站交战...

错误:警告:mysql_connect()函数:页眉和客户端库次版本不匹配。 头:50547图书馆:50628在/home/lhu/public_html/innovacarrentalschennai.com/wp-includes/wp-db.php上线1515

原因:我更新WP 4.2到4.5版(PHP和MySQL不匹配)

我改的wp-db.php中上线1515

$this->dbh = mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags );

if ( WP_DEBUG ) {
    $this->dbh = mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags );
} else {
    $this->dbh = @mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags );
}

它不会对我的WordPress网站交战ERR GOT



Answer 8:

如果妳有域虚拟主机访问的cPanel或南国...

在的cPanel,进入“软件和服务”选项卡,>>然后点击“选择PHP版本” >>设置所需的PHP版本...

例如。 当前的PHP版本:

PHP版本[5.2](5.2列表,5.3,5.4,5.5,5.6可用PHP版本)

警告:通过PHP选择更改PHP模块和PHP选项原生PHP版本是不可能的

我选择5.6版本的PHP,后在我的WordPress博客网站清除的错误......



Answer 9:

Warning: mysqli::mysqli(): Headers and client library minor version mismatch.
Headers:50547 Library:100026

我刚好重建我的Apache解决了上述错误:

cPanel Version  56.0 (build 25)
Apache Version  2.4.18
PHP Version 5.5.30
MySQL Version   10.0.26-MariaDB


Answer 10:

我有这样的问题,当使用的Percona / MySQL的5.6和PHP驱动程序与5.5和PHP5-MySQL是需要一些应用程序编译,所以我写一个脚本来重建驱动程序。

https://github.com/falcacibar/php5-mysql-rebuild



Answer 11:

对于小南国和的cPanel,一些版本需要explicty设置mysqli的建立。

使用小南国,下CENTOS 6.9 Xen的PV [DC] v68.0.27,一个看着都选择重建的Apache / PHP和选择的mysqli建设需要。 默认是建立在过时的MySQL。 现在贬值的消息都消失了,一个是准备未来的MySQL升级。



Answer 12:

修改PHP版本从5.6到5.5的固定它

你必须去控制面板> CGI脚本并改变PHP版本存在。



文章来源: Headers and client library minor version mismatch