@christine-kaminski opened this Issue on August 4th 2017

We are using Piwik vs 3.0.2 on CentOS 7 with MariaDB 10.0.31. It works fine so far. Unfortunately the system information in the settings show MySQL 5.5.5 instead. Though Piwik and PHP version are displayed correctly. Any idea how to fix this?

@christine-kaminski commented on August 4th 2017

piwik

@mneudert commented on August 4th 2017 Member

tl;dr: The version you are seeing is not "wrong".

You could set a custom version string from MariaDB 10.2.6 onwards (see here) but not earlier. And just fixing the version displayed might break other things yet to be known...

As long as MariaDB stays reasonably compatible with MySQL there should be no problems.


In detail this is a result of how MariaDB reports it's version. Take for example the following code:

$db = new PDO('mysql:host=127.0.0.1', 'root', 'password');
echo $db->getAttribute(PDO::ATTR_SERVER_VERSION);

If you execute this on your server in an interactive PHP shell (php -a) you should receive something like 5.5.5-10.0.31-MariaDB (an Ubuntu 16.04 installation I just looked this up in returned 5.5.5-10.0.29-MariaDB-0ubuntu0.16.04.1).

After receiving this value the underlying Zend_Db_Adapter_Pdo_Abstract extracts and returns (see here) just the first part of it. That is where your 5.5.5 is coming from.

Even further down the rabbit hole you see the MariaDB source code with an explanation (see here) about why they did that. Also mentioning they manually patched their clients to just strip this version from getting printed.

@sgiehl commented on August 6th 2017 Member

@mneudert do you think there is something we could improve in version detection for MariaDB? Or would that require changes to Zend_Db_Adapter_Pdo_Abstract?

@mneudert commented on August 6th 2017 Member

As modifying external libraries is always a bad idea the most promising change seems be extending Piwik\Db\Adapter\Pdo\Mysql with something like a getRawServerVersion.

Changing getServerVersion would mess with the version requirement checks as we would not compare a "MySQL compatibility promise" but a totally different versioning scheme.

Having a custom display version could provide something really specific like MariaDB 10.0.2 (MySQL 5.5.5 compatible).

@christine-kaminski commented on August 7th 2017

Thanks guys!

Powered by GitHub Issue Mirror