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
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
Related
Today some of my packages in Ubuntu was upgraded automatically, and I didn't think of what was actually going on.
Ever since the update, my local dev-environment doesn't work anymore. First of by not working was mod_rewrite which I had to enable again using a2enmod. But now I've run into an issue that I can't seem to resolve. My application can't seem to find the PDO MySQL driver. When running the application, I get the error failed to open the DB connection: could not find driver.
This is strange, since if I check the phpinfo() the PDO drivers do support MySQL, and the socket path is a valid path.
pdo_mysql client API version is 5.5.35 according to php info.
PHP5: 5.5.3
MySQL: 5.5.35
Connectionstring
mysql:host=127.0.0.1;dbname=MyDB;port=3306
What could be causing this?
The PHP MySQL driver (mysql.so/mysqli.so) and the PHP PDO MySQL driver (pdo_mysql.so) are two separate modules. You need both of them for PDO functionality with MySQL.
It is quite possible that one of them is missing or of an incompatible version - I do not have an Ubuntu system at hand, but on my RPM-based Linux distribution there is a separate package for each module (php-mysql/php-mysqli and php-pdo_mysql). I also expect PDO to be using the newer mysqli.so driver, rather than the obsolete mysql.so one, so you should verify that one is installed as well.
Try this:
sudo apt-get install -y php5-mysql php5 mysql-client
This should automatically restart your apache if any of the dependencies aren't installed.
Try using vagrant.
Dependencies can be isolated, upgraded and downgraded when you like.
Vagrant
I've got a rather tricky problem with my webserver since I performed a regular package update last Friday. I'm getting an error when using mysql_connect().
Warning: mysql_connect(): Headers and client library minor version mismatch. Headers:50532 Library:100005 in /srv/www/***/wp-includes/wp-db.php on line 1142
When I run php -i I get:
mysqli
MysqlI Support => enabled
Client API library version => 10.0.5-MariaDB
Client API header version => 5.5.32
apt-get install mariadb*
Results in the following packages already installed:
libmariadbclient18 is already the newest version.
libmariadbclient18 set to manually installed.
mariadb-client is already the newest version.
mariadb-client-10.0 is already the newest version.
mariadb-client-10.0 set to manually installed.
mariadb-client-core-10.0 is already the newest version.
mariadb-client-core-10.0 set to manually installed.
mariadb-common is already the newest version.
mariadb-common set to manually installed.
mariadb-server is already the newest version.
mariadb-server-10.0 is already the newest version.
mariadb-server-10.0 set to manually installed.
mariadb-server-core-10.0 is already the newest version.
mariadb-server-core-10.0 set to manually installed.
I've already looked up this issue all over the web, but none of the similar issues seem to have the -MariaDB tag with the library version.
So I've no idea how I can resolve this.
Your help is greatly appreciated!
edit:
php -i mysql:
MySQL Support => enabled
Client API version => 10.0.5-MariaDB
Oddly enought there is no mention of a Client API library version or
Client API header version in this section.
Enable the mysqlnd, nd_mysql, and nd_mysqli extentions for PHP, and disable mysql and mysqli if they are enabled (PHP 5.5).
Late response, but this is high in the search results and this is the solution that worked for me, as someone who did not have admin access to the server.
Install the mysqlnd package for PHP and the warning should go away.
For Debian/Ubuntu based systems, this would be:
sudo apt install php-mysqlnd
or
sudo apt install php7.0-mysqlnd
Restart your server daemons after installing (apache, nginx, and/or php-fpm)
I am trying to set up a old PHP version using Macports on Snow Leopard. I have installed sudo port install php52 +apache2 +mysql5-server with no problem when I then try to install php5-mysql I get the following error.
Error: php5-mysql 5.3.6 requires PHP 5.3.6 but you have PHP 5.2.17.
Error: Target org.macports.configure returned: incompatible PHP installation
Log for php5-mysql is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_php_php5-mysql/main.log
Error: Status 1 encountered during processing.
To report a bug, see <http://guide.macports.org/#project.tickets>
I have tried to search the MacPorts help although this has not been very helpful to me in finding anything that relates to my problem.
Find an older version of php5-mysql that works with your PHP version, which is 5.2.17. Otherwise you will always run into this problem.
This is also known as a package dependency. If you can not fullfil a dependency, the package can not be installed (well it probably could, but then it would not run, so the package manager refuses you to install that).
From the changelog of the mysqli package it does not look like that 5.2 is supported, but according to linked information it might have been in some older package.
I've recently upgraded MySQL on my Debian 5.0.4 server to 5.1. Now phpMyAdmin shows the following warning:
Your PHP MySQL library version 5.0.51a differs from your MySQL server version 5.1.43
Is it likely to cause any problems?
The message indicates that :
You are using version 5.1.43 of MySQL server
But that the library that's used by PHP to communicate with that server has been compiled to communicate with a version 5.0.x of MySQL.
In theory, this should not cause any real problem : minor versions tend to be compatible ; but you might need to update the library that's used by PHP ; maybe some package like "libmysql", or something like that (I don't have a Debian machine)
If you want to make that warning disappear (even if I'm not sure it could really cause any big problem), you'll have to update the PHP component that is used to communicate with MySQL.
Note : With the dependancies, it might not be that easy, actually, to upgrade just one package...
I would say that you'd have to update something like php5-mysql ; which means :
apt-get install php5-mysql
(According to this page -- amongst others -- to update a single package, your must use install)
If you are using aptitude, and not apt-get... Not sure about the right option that you should use to update only one package ; still, aptitude safe-upgrade should present you with a list of packages it will upgrade, which will allow you to decide whether or not you wish to continue...
But you said in a comment to another answer that Debian ships by default with MySQL 5.0 -- which means the "official" module for PHP is probably compiled against libmysql 5.0, and not libmysql 5.1.
To solve that problem, you'll have to either :
Find a repository that provides PHP (or, at least, the mysql extension) compiled against libmysql 5.1
Or re-compile PHP and/or the mysql extension against the version of libmysql that's currently used on your system -- i.e. libmysql 5.1
Try running sudo apt-get update mysql-client.
I was seeing this in the phpMyAdmin console - I run Debian 8 on Google cloud and recently upgraded to mysql 5.7.21. I had to run the PHP NativeDriver to get this to subside
sudo apt-get update
sudo apt-get install php5-mysqlnd
So you basically have php-mysql and php-mysqlnd drivers...
On CentOS 7, I made version error go away by:
yum remove php-mysql.x86_64
yum install php-mysqlnd.x86_64
Note that removing php-mysql also removed phpMyAdmin, but I installed it again without any problems.
Error related to lib versions is gone now, but not sure if phpMyAdmin just doesn't check versions of drivers for the mysqlnd version or the php-mysqlnd is just more compatible.
In Debian/Ubuntu you can overcome that notification by using the following command in the latest repository defined in /etc/apt/sources.list.
sudo apt-get upgrade mysql-client
That will solve your problem perfectly.
Have a great day.
sudo apt-get update php5-mysql
Does anyone know how, on Ubuntu 8.04, with PHP 5 and MySQL 5.0, to enable/install the mysqli package/extensions?
Preferably I'd like to preserve the existing installations, but, if necessary, I'll reinstall from scratch.
I realise it's not, technically, programming-related but, I think (at a stretch, maybe) it's programming-enabling? hopes
Thanks for any help you're able to provide.
In Ubuntu Hardy (8.04) mysqli is part of the php5-mysql package along with the standard mysql library and pdo - see http://packages.ubuntu.com/hardy/php5-mysql for more info.
sudo apt-get install php5-mysql
You might have to install php with the mysqli option: apt-get install php5-mysqli
From the PHP documentation.
To ensure that the mysqli extension for PHP is enabled, you will need to configure the PHP source code to use mysqli. This is achieved by running the configure script with the option --with-mysqli=mysql_config_path/mysql_config, prior to building PHP. This will enable mysqli and it will use the MySQL Client Library (libmysql) to communicate with the MySQL Server.
But since you are on ubuntu. You can just install the mysqli package. Details about it here.
sudo apt-get install php5-mysqli
With PHP5 php5-mysqli package is not available, but it is replaced by another package. May be package is obsolete.
It can be downloaded by the following command
sudo apt-get install php5-mysqlnd