phpinfo() shows MySQL, PMA shows MariaDB - php

I am really confused about that
There is a phpinfo() output:
MySQL Support enabled
Client API version 5.5.40
MYSQL_MODULE_TYPE external
And the phpMyAdmin shows:
Server type: MariaDB
MariaDB is a fork of MySQL, but does that mean that MDB IS a MySQL database? Why phpinfo does not provide any information about MariaDB?
I am not sure if php is correctly configured on my hosting server, either not sure how to check it.

There is not necessarily a 1:1 correspondence between web servers running php and database servers running MySQL (or a different kind of database). The two things, even if running on the same system, are not connected or aware of each other, unless your php code specifically connects to the MySQL Server, and it isn't unheard of for a web app to connect to more than one MySQL Server.
So to expect the php info script to know anything about the MySQL Server is to expect the wrong thing.
Client API version 5.5.40
This means php has the MySQL client module that shipped with MySQL Server 5.5.40 and so is fully compatible with any MySQL Server up to and including version 5.5.40, and for the most part should also work with newer versions.
MariaDB is, for most purposes, fully compatible with MySQL Server, and the MySQL client library used by php.
Oracle owns MySQL. MariaDB is based on MySQL, and includes performance improvements of its own as well as some that were integrated from a third product, Percona Server, which is also MySQL compatible. MariaDB and Percona both are essentially drop-in replacements for MySQL. They look and act and communicate just like MySQL (with exceptions not relevant to the average user) and php doesn't know the difference, or care. A fourth variant is Amazon Aurora, also MySQL compatible, but some legacy capabilities are removed and others enhanced, in the interest of very high performance. Aurora is only available as a cloud service; the others can all be installed locally.
But php is only showing you its capability of connecting to MySQL -- not info about the MySQL server itself.

Related

Can Microsoft's SQLSRV driver for PHP run on Apache?

Scenario:
I have a PHP website running on Apache server
I have an ERP system (MS SQL) that runs on a different server
I need to connect from my website to that MS SQL server
I need to work with Microsoft SQL Server in my PHP application. I've managed to get their SQLSRV driver for PHP running on my localhost (WAMP, Apache + PHP 7.2).
I will need to deploy the app to a live website in the future that also runs on Apache server. Will this work? I can see Windows / Windows Server operating systems on their requirements page, but I am not sure whether they mean on the client side (the app that loads the driver) or the server side (where database is stored). On WAMP it works, but I am not sure whether it is because the WAMP itself is running on Windows (even though the server runs on Apache) or not.
Firstly, you're asking the wrong question. Apache is the web server which you're already using, so you know that the answer to "can it run with Apache?" is "yes".
The relevant compatibility is with the operating system - you're running it on Windows, and you need to know if it will run on a different OS, probably some flavour of Linux.
Secondly, the documentation you've found looks to be very out of date. Microsoft has up to date documentation on their own site including a much larger list of supported operating systems. As well as Windows, it lists the versions of several Linux distributions that are officially supported, and several versions of macOS.
It's impossible to say for certain, or give any details of what packages you'll need to install, because you don't actually tell us what system your production server is; but the answer is almost certainly yes, a compatible version of the sqlsrv driver will be available.

Does the mysql client package version on webserver affect PHP queries?

I have two RHEL servers, one to host the PHP application, one to host the MySQL server.
Database server has MySQL Enterprise version 5.6.21 installed.
While getting the application server built, I asked that the rpm MySQL-client-advanced-5.6.21-1.el6.x86_64 be installed (to match server), but the hardware people don't like this version since 5.6.27 is available which addressed some vulnerabilities.
The question is the following:
Does the mysql client version on the application server affect the database queries coming from the PHP application?
We're using PDO to connect to and query MySQL.
If we do this, does the application server even need a mysql client library?
Please let me know if I can clarify.
Thanks!
PHP uses its own library/driver to connect to MySQL databases. The MySQL-client-advanced package is just the CLI mysql client. PHP does not use this.
For PHP (and PDO), you should install php-pdo and php-mysqlnd. php-mysqlnd is the "MySQL native driver" and contains some enhancements. It also contains the mysqli class and the pdo-mysql connector.
Note: php-mysqlnd versions are unrelated to the MySQL server version.
Quote from the Mysql website
MySQL Native Driver is a replacement for the MySQL Client Library (libmysqlclient). MySQL Native Driver is part of the official PHP sources as of PHP 5.3.0.
https://dev.mysql.com/doc/apis-php/en/apis-php-mysqlnd.html

Can MySQL seamlessly be replaced with MariaDB or are there things to change in this case?

If I replace a MySQL 5.1 server with a MariaDB Server (Maria & XtraDB storages) instead of MySQL (MyISAM & InnoDB), will most of MySQL client software (incl. applications made with PHP 5.2 and Java SE 1.6) ...
just remain working without any changes (with minor regressions maybe)?
Or will I have to replace/reconfigure client drivers (like use another JDBC driver class and connection string)?
Or will I have even to change application code?
http://kb.askmonty.org/v/mariadb-versus-mysql
All MySQL connectors (PHP, Perl, Python, Java, MyODBC, Ruby, MySQL C connector etc) works unchanged with MariaDB.
I have used Mariadb as replacement for Oracle's MySQL for years. It is faster and very reliable. Needs just little attention in apt, but nothing severe. Also, there is one small detail with Mariadb; it is seeing [error] "PHP Warning: mysql_connect(): Headers and client library minor version mismatch" in the logs. I haven't found any other solution to that other than to start manually compiling: askMonty.
$php -i | grep 'Client API'
Client API version => 5.3.7-MariaDB
Client API library version => 5.3.7-MariaDB
Client API header version => 5.1.61
Client API version => 5.3.7-MariaDB
just remain working without any changes (with minor regressions
maybe)?
You shouldn't have any issues as long as you replace with the same version. If you're currently are using MySQL 5.1, you can replace with MariaDB 5.1. If you are using 5.5, use the corresponding one. MariaDB v5.2 and v5.3 and enhanced versions of 5.1.
Or will I have to replace/reconfigure client drivers (like use another
JDBC driver class and connection string)?
You shouldn't. MySQL and MariaDB both use the same protocol and overall syntax, but there could be a few exceptions in some cases. The URL quoted in another answer is a great resource: http://kb.askmonty.org/v/mariadb-versus-mysql
Regarding the drivers' licenses, there are differences if you plan to distribute your project commercially. In that case I recommend you to double check the license terms and if you have any concerns, use the MariaDB/SkySQL versions of the connectors as suggested in another answer. Check http://www.skysql.com/downloads/java-cc-connectors-mariadb for details.
Or will I have even to change application code?
The application code should be unchanged.
Just a little feedback requarding the compatibility with mysql driver/CodeIgniter. I ran into the problems on BIT attributes types few minutes ago.
Value was not retrived from the server. It was always empty.
I was using standard CI database configuration which is using "mysql" driver.
After changing driver in the database.php to "mysqli" problem was solved.
Just the heads up that there can be some differences if you are using old mysql driver.
$db['default']['dbdriver'] = 'mysqli';
MariaDB client API version 5.5.40
MariaDB is MySQL evolved.
It is also the same developer who is behind MySQL and MariaDB. It is almost the same (if it is not, i can only say MariaDB is MySQL improved, dot).
You don't have to change nothing in your PHP.
Contrary to popular belief, the default Connector/J JDBC driver for connecting to and interacting with MySQL in Java does not play nicely with MariaDB. To work with MariaDB, you need to have your application use the Drizzle or SkySQL driver.
http://kb.askmonty.org/en/mariadb-faq-is-there-any-java-connector-for-mariadb-than-the-one-from-mysql

Pervasive & Linux

I'm interested in quering a Pervasive DB server running on a Windows platform from Linux.
Would anyone happen to know if this is possible, what's required and what resources there are for me to read up on it?
Thanks!
What version of Pervasive are you using? All versions since v8 (including v9 and v10) support a Linux client which is included with the Pervasive.SQL server engine. V9 and V10 clients are also available for download from the Pervasive website (http://www.pervasivedb.com/Database/Products/PSQLv10/Pages/PSQLOverview.aspx). Once you've got a client installed on the Linux machine, you can create an ODBC DSN or use the Btrieve API to access the data.
Most database have at least a command line client to connect to database. check your brand of database to see if you have such tools. For example, Mysql has mysql command line client for making query to MySql database. Otherwise, another way is you might want to try setting up ODBC with Perl.

What problems can arise if php mysql client doesn't match the mysql server version?

I have two installations of mysql server 5.1.32 and 5.0.77 (same machine, os x leopard). My php mysql extension is compiled against 5.0.77 (that was the easiest thing to do, and I did it after installing 5.1.32). I'm using the 5.1.32 installation since that's what I compiled my python MySQLdb extension against. I don't code in php much if ever. My main use of the php installation is phpmyadmin. phpmyadmin works in this way against the 5.1.32 mysql server but shows a warning:
"Your PHP MySQL library version 5.0.77 differs from your MySQL server version 5.1.32. This may cause unpredictable behavior.".
My question. Can I expect any serious problems from phpmyadmin with this kind of setup?
I'm using the latest version of phpmyadmin, and it connects thru a tcp connection (not socket file).
You shouldn't have any problems, all the queries are sent over TCP, they are all pretty much standard.
I think the only bad thing is that you can't use ceratin features.
If the developers are respectable, using an older client version on a newer server version shouldn't ever cause issues with any software.
Using a newer client version with an older server version may cause issues depending on the developers policies.
You should be ok however some functions/bugs/quirks could differ between the two versions. I would recommend looking at the MySQL's changelog from version 5.0.77 up to (and past if you have time) 5.1.32.
There was an issue with MySQL user's passwords stored between a version of MySQL 4.11 and up connecting to a version lower than that. Since you're this far I'm sure that's not it. For reference it was an easy fix involving updating the user's password with OLD_PASSWORD().

Categories