Page 1 of 1

MySQL Version Error

PostPosted: 03. June 2013 19:02
by pclove
I'm trying to locally test a PHP script. When I run the install script, it tests a few checks of server program versions.

The error I get is regarding the MySQL version.
"MySQL Version: mysqlnd 5.0.10 - 20111026 - $Id: b0b3b15c693b7f6aeb3aa66b646fee339f175e39 $ Not OK!"

When I test this script on my webhost, the tests pass and the MySQL version shows this:
"MySQL Version: 5.5.30 OK!"

So, obviously, my question is what do I need to change to make this work?

I also tested EasyPHP and WAMP and they gave the same error.

Re: MySQL Version Error

PostPosted: 03. June 2013 23:24
by Altrea
Hi pclove,

Please start new threads with the words "Hi" or "Hello". A short salutation is an act of politeness. Even if the internet is an virtual area, there is always a human being behind the screen. A polite beginning is the first positive impression you can leave here and helps to get polite answers too. Please keep that in mind if you start a new thread in any community board. Thank you.

PHP doesn't have the possibility to determine the MySQL Server version itself.
There are two ways to check for the correct server version but:

with the help of Shell without the need to login to the database
Code: Select all
function getMySQLVersion() {
    $output = shell_exec('mysql -V');
    preg_match('@[0-9]+\.[0-9]+\.[0-9]+@', $output, $version);
    return $version[0];
}
print mysql_get_client_info();


After login with the php function mysql_get_server_info()

The first version is not bullet proof because not everyone has shell access
The second one needs a successful mysql connection

The only information PHP can get without asking the database is the information from the mysql connector which is the MySQL Client version.
This Client version can be very different from the Server version without losing any functionality.

There is nothing you can do except looking for new versions, fixes or workarounds of your webapplication.

best wishes,
Altrea

Re: MySQL Version Error

PostPosted: 04. June 2013 13:57
by pclove
Hello. :P

What I understand is that when PHP requests the DB info such as version, it identifies the mysql connector if there is no previous connection to that DB.

The webapp I'm testing has an installer. Would it be feasible to preset the DB connection in the webapp's config file previous to running the installer? And would PHP then be able to successfully identify the correct version and allow the install to continue?

Thanks for your time behind the screen.

Re: MySQL Version Error

PostPosted: 04. June 2013 14:08
by Altrea
pclove wrote:Would it be feasible to preset the DB connection in the webapp's config file previous to running the installer?

Depends how the webapp is function for determine the mysql version is coded. In most cases: no. Ask the developer of that script

pclove wrote:And would PHP then be able to successfully identify the correct version and allow the install to continue?

Again: Depends how the webapp will determine the mysql version. I have shown you the possibilities how to get the correct mysql version number.
Everything else is part of the webapp developer.