Your PHP MySQL library version differs from your MySQL server version - php

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

Related

How to install phpMyAdmin only with PHP7.3 on Ubuntu 18.04?

I have an Ubuntu 18.04 server with Apache, PHP7.3, and MariaDB.
Now I need to install phpmyadmin and I tried to do that using the code below:
apt install phpmyadmin
But this command will install and replace the PHP7.4 with PHP7.3, whereas I need to keep using PHP7.3.
How can I do this?
How have you installed PHP 7.4, since Ubuntu Bionic (18.04) includes PHP 7.2 (https://packages.ubuntu.com/bionic/php)?
You seem to have gone outside of the standard packages (perhaps you're using the excellent effots provided by Ondřej Surý at https://deb.sury.org/). In this case, it's going to cause you some amount of grief to mix and match the newer PHP with the distribution's phpMyAdmin, because of these dependency problems.
You could force the matter. This is probably going to cause you problems, since Bionic packages phpMyAdmin 4.6.6, which is only supported up to PHP 7.1. https://serverfault.com/questions/250224/how-do-i-get-apt-get-to-ignore-some-dependencies has some instructions on ignoring the dependencies. I recommend avoiding this solution.
You could install your own phpMyAdmin. Download the source from phpmyadmin.net and uncompress it to your web root. You may need to add a short configuration file, config.inc.php, but mostly it just works with the default settings. https://docs.phpmyadmin.net/en/latest/setup.html has a quick start section.
You could downgrade your PHP, but you've already stated this isn't a good option for you, and I'm not sure how the Ubuntu package managers get phpMyAdmin working with this newer PHP version.
Clearly, I think the best solution for you to is to install your own phpMyAdmin.

How to run PHP with Firebird InterBase in VestaCP (CentOS)

I'm running VPS with VestaCP (CentOS) and I had previously installed InterBase for PHP 7.0.30, but after an yum-update and v-update-sys-vesta-all interbase was no longer running.
Here is what I've got so far:
Okay soo with new update the new PHP 7.1.17 version was installed. Allright, but the interbase module is not running with it.
And first thing I did was yum --enablerepo=remi install php71-php-interbase to install interbase for this new PHP version.
Tried to restart but still getting missing InterBase error if I try to use ibase_connect() function - therefor InterBase is still not properly installed.
I tried to follow PHP InterBase documentation on this, but I realized I have to compile it and add extra parameter on run, but the problem is that VestaCP uses different directories and libraries so I don't want to mess up my VPS.
Has anybody dealt with this? Any "howto's" to follow?
This answer is what #Mark Rotteveel already pointed out in the comments, but only with additional steps.
I had to compile PHP 7.1.17 from source with --with-interbase[=DIR] in configuration and then include it in php.ini
[UPDATE]
I found even faster way to do this automatically (if only I had known this earlier I would have saved few hours of research).
Answer
Just run yum -y install php php-interbase and you will be all set.

Can't find MySQL driver anymore (Linux)

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

Headers and client library minor version mismatch

In PHP I'm getting the following warning whenever I try to connect to a database (via mysql_connect)
Warning: mysql_connect(): Headers and client library minor version mismatch. Headers:50162 Library:50524
In my php -i output I have the following values listed under mysqli
Client API library version => 5.5.24
Client API header version => 5.1.62
I've tried updating php5-mysql and php but I'm already at the latest version of both of them. How do I go about updating the header version so I stop seeing this warning?
EDIT
My MySQL files should all be updated to be the latest version:
$ 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.
Removing old versions
$ 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
I am using MariaDB and have a similar problem.
From MariaDB site, it is recommended to fix it by
Switch to using the mysqlnd driver in PHP (Recommended solution).
Recompile PHP with the MariaDB client libraries.
Use your original MySQL client library with the MariaDB.
My problem was fixed by using the mysqlnd driver in Ubuntu:
sudo apt-get install php5-mysqlnd
[update: extra information] Installing this driver also resolve PDO problem that returns integer value as a string. To keep the type as integer, after installing mysqlInd, do this
$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);
For new MySQL 5.6 family you need to install php5-mysqlnd, not php5-mysql.
Remove this version of the mysql driver
sudo apt-get remove php5-mysql
And install this instead
sudo apt-get install php5-mysqlnd
Your PHP was compiled with MySQL 5.1 but now it is linking a mysql library of 5.5.X family.
You have to upgrade PHP to a version compiled with MySQL 5.5 or revert back mysql client libraries to 5.1.x.
The same works for MySQL:
sudo apt-get install php5-mysqlnd
I've read this thread trying to find the solution for MySQL, and I've also seen ken's answer, but I ignored the solution for MariaDB, wasting a few hours that way. It wasn't clear for me that the same may apply to MySQL. This post is just to spare you the few hours I lost.
The root reason for this error is that PHP separated itself from the MySQL Client libraries some time ago. So what's happening (mainly on older compiles of linux) is that people will compile PHP against a given build of the MySQL Client (meaning the version of MySQL installed is irrelevant) and not upgrade (in CentOS this package is listed as mysqlclientXX, where XX represents the package number). This also allows the package maintainer to support lower versions of MySQL. It's a messy way to do it, but it was the only way given how PHP and MySQL use different licensing.
MySQLND solves the problem by using PHP's own native driver (the ND), which no longer relies on MySQL Client. It's also compiled for the version of PHP you're using. This is a better solution all around, if for no other reason that MySQLND is made to have PHP talk to MySQL.
If you can't install MySQLND you can actually safely ignore this error for the most part. It's just more of an FYI notice than anything. It just sounds scary.
My hosting company told me to fix this by deactivating "mysqli" and activating "nd_mysqli" in the php extensions.
The error is gone, but I don't have the knowledge to understand if this is the right method to fix this.
To compile php from source with MySQL native driver (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
From /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
One or more PHP MySQL extensions can be included by using these options.
If a value is not passed to these options, or if the value is mysqlnd, MySQL native driver will be used.
I got same php warring in my wordpress site...
Err: Warning: mysql_connect(): Headers and client library minor version mismatch. Headers:50547 Library:50628 in /home/lhu/public_html/innovacarrentalschennai.com/wp-includes/wp-db.php on line 1515
Cause: I updated wp 4.2 to 4.5 version (PHP and MySql mismatch )
I changed wp-db.php on line 1515
$this->dbh = mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags );
to
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 );
}
Its got without warring err on my wordpress site
If u had access cpanel or whm for domain web hosting ...
In cPanel, Go to "Softwares and services" tab, >> and then click "Select PHP Version" >> set your desired version of php...
Eg.
Current PHP version:
PHP Version [5.2] ( list of 5.2, 5.3, 5.4, 5.5, 5.6 available php versions)
Warning: Changing php modules and php options via PHP Selector for native php version is impossible
I selected 5.6 php version, after that error cleared on my wordpress blog site...
Warning: mysqli::mysqli(): Headers and client library minor version mismatch.
Headers:50547 Library:100026
I solved the above error by just rebuilding my Apache:
cPanel Version 56.0 (build 25)
Apache Version 2.4.18
PHP Version 5.5.30
MySQL Version 10.0.26-MariaDB
For WHM and cPanel, some versions need to explicty set mysqli to build.
Using WHM, under CENTOS 6.9 xen pv [dc] v68.0.27, one needed to rebuild Apache/PHP by looking at all options and select mysqli to build. The default was to build the deprecated mysql. Now the depreciation messages are gone and one is ready for future MySQL upgrades.
I ran into the same issue on centos7. Removing php-mysql and installing php-mysqlnd fixed the problem. Thanks Carlos Buenosvinos Zamora for your suggestion.
Here are my commands on centos7 just in case this can be of help to anybody as most of the answers here are based on Debian/Ubuntu.
To find the installed php-mysql package
yum list installed | grep mysql
To remove the installed php-mysql package
yum remove php55w-mysql.x86_64
To install php-mysqlnd
yum install php-mysqlnd.x86_64
Works for MariaDB 10.6.4-MariaDB, php56w, on centos 7.7
yum remove php56w-mysqli
yum install php56w-mysqlnd
Changing PHP version from 5.6 to 5.5 Fixed it.
You have to go to control panel > CGI Script and change PHP version there.

MySQL => MariaDB = PHP Errors Header/Library versions

I managing a little vps of my own and I've recently moved from mysql to mariadb (5.3).
On some php test projects that usually worked under php5/mysql5, I get some header errors about MySQL versions.
Headers and client library minor version mismatch. Headers:50158 Library:50303
My guess here is : MariaDB 5.3 is the Library, and the Headers is the libmysqlclient.
I don't know where I've failed when updating/installing (even tried remove mysql and only install mariadb) but it seems that it happens with the php-mysql package.
I've tried to use the -o from apt-get to configure --with-mysql=mariadb-devel as I've seen on a topic, but in fact, it seems I don't know how to configure php5-mysql package (I don't even know what does it do : configurations files or libraries ?)
Well to sum up, why is my PHP5 MySQL header still in 5.1 where the library is 5.3 ?
Thank you in advance for any help,
Lucas.
[ Plus ]
How can I recover the configure parameters from an apt-get install ?
I've got no results when i use :
php5 -i | grep configure
Your PHP5 MySQL header still in 5.1 where the library is 5.3 is because PHP was not recompiled with the new headers (nor it should be because 5.3 remains binary backward compatible).
The check in the driver in itself is wrong, or better say too overcautious. PHP (mysqli) is unique among MySQL drivers in that it would barf when minor version is higher than the one that was compiled in.
Here is bug report for PHP MySQL driver
I had this problem and i solved it:
(I have Server version: 5.3.5-MariaDB-ga-mariadb113-log and php 5.4.0 installed on my server)
I downloaded php 5.4.0 source and compiled mysql.so manually.
This is solution:
# cd /root/php-5.4.0/ext/mysql
# phpize
# ./configure --with-mysql=/usr --with-libdir=lib64/mysql
# make
mysql.so have been compiled without errors and works fine.
Note: MariaDB-devel package and php-devel package needed.

Categories