0

After installing php5-mysqlnd, php5-mysql is removed. I install php5-mysql, php5-mysqlnd is removed and I can use mysqli. However, I will received this error

mysqli_real_connect(): Headers and client library minor version mismatch. Headers:50541 Library:50627

Based on other answers on stackoverflow, I need to install php5-mysqlnd to fix this. How to break out of this cycle?

UPDATE 1:

  • Try to add extension = mysqlnd.so in php.ini
  • try php5enmod mysqli and php5enmod mysqlnd in bash
  • mysqli still does not work after installing php5-mysqlnd by apt-get
  • 1
    You cannot have both installed at once. [The PHP docs recommend you use mysqlnd](http://php.net/manual/en/mysqlinfo.library.choosing.php). – Mike Jun 08 '16 at 04:54

1 Answers1

1

mysqli_real_connect(): Headers and client library minor version mismatch. Headers:50541 Library:50627

The error message means that there is a version conflict on your system. You installed the package containing "libmysql" and the package "php5-mysql" which links against that library, while using a different version. This indicates that there either is a bug in packaging from Ubuntu (unlikely) or you messed up with different package sources. To be precise: PHP thinks it would use libmysql 5.5, whereas 5.6 is installed.

Anyways, to the other part of the question: php5-mysqlnd and php5-mysql both contain the different MySQL userspace API libraries (mysql, mysqli and pdo_mysql) one package is the "traditional" one where those modules use libmysql, the other is the "modern" one where those modules use myslqnd. Documentation explaining the difference is on http://php.net/manual/en/mysqlinfo.library.choosing.php short form is: Use mysqlnd unless you have very specific requirements (i.e. using libmysld, with d in the end .. if you don't know what this is you don't want to use it; don't let it confuse you, use mysqlnd)

Now if there is no mysqli after installing php5-mysqlnd this might be caused by Ubuntu installing it, but not enabling the module, for this Ubuntu has a tool php5enmod try this:

php5enmod mysqli  
johannes
  • 15,807
  • 3
  • 44
  • 57
  • Thank you so much for your help. However, it does not work. Is there any other way? Or if there is any information I can give you to fix this bug? – Viet Quang Tran Jun 10 '16 at 03:57