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:
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 (ie 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
You probably need to enable the mysqlnd extension. I ran into this problem recently (all references mysqli were broken after installing php5-mysqlnd), and fixed it by adding the following line to the bottom of my php.ini:
extension=mysqlnd.so
You can find the location of your php.ini in the output of phpinfo().
Also note you'll need to restart your webserver for these changes to take effect.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.