Kesong Xie
Kesong Xie

Reputation: 1396

mysql_connect can not work in remote server in stead of local server

I got such warning :

Warning: mysql_connect(): Headers and client library minor version mismatch. Headers:50537 Library:50617

when try to upload my code to my remote server, and my remote server currently using php 5.5 , It's because the mysql extension has been already deprecated so that i have to change the extension to mysqli? but in my local server, i tested in php 5.5 too and it works as normal

what would be the issue here?

Upvotes: 0

Views: 1621

Answers (2)

etr
etr

Reputation: 1262

I think your issue is this:

After having MySQL 5.6.17 published, some users complained about a warning thrown by their PHP applications :

PHP Warning: mysql_connect(): Headers and client library minor version mismatch. Headers:50535 Library:50617

In fact, this could happen with any application linked to libmysqlclient18 in a certain version (php5-mysql from Dotdeb is linked to the 5.5.35 version from the stock Debian distribution) when connecting to a MySQL server in another version (5.6.17 in our case). The warning is thrown by libmysqlclient18 itself. And this is just a warning, there is no reason why any bad behavior would happen in that case.

Of course, I could build php5-mysql against the latest libmysqlclient18 (5.6.17), but it would lead to very bad issues, such as duplicate symbols or segfaults when PHP is loaded with other MySQL-linked modules from the stock Debian distribution (those are linked to libmysqlclient18 5.5.35). For example : mod_php5 + Apache + mod_auth_mysql would crash.

If this this warning really annoys you, feel free to install php5-mysqlnd instead of php5-mysql :

it’s a drop-in replacement
it’s not linked against any libmysqlclient library
it won’t throw any irrelevant warning about version mismatch
it has a lot of benefits. See http://www.php.net/mysqlnd for more info

I hope this helps.

Upvotes: 1

dom
dom

Reputation: 321

If you are running ubuntu/debian.

     apt-cache search php5-mysqlnd

Find one that fits:

     apt-get install php5-mysqlnd

Upvotes: 2

Related Questions