Big McLargeHuge
Big McLargeHuge

Reputation: 16056

How can I tell what version of mysqli is installed?

I'm putting together some documentation for developers and I want to include the required PHP extensions and versions of each. For instance, one requirement is gd 2.1.1 and another is phalcon 2.0.1.

I know how to figure out what versions of PHP and MySQL are installed, but I can't figure out what version of the mysqli extension I have. phpinfo shows the following information under the mysqli extension section:

MysqlI Support  enabled
Client API library version  5.5.43
Active Persistent Links 0
Inactive Persistent Links   0
Active Links    0
Client API header version   5.5.41
MYSQLI_SOCKET   /var/run/mysqld/mysqld.sock

I think this just tells me that the version of MySQL I have installed is 5.5.43, which I assume is different from the version of mysqli.

dpkg shows the version of php5-msyql is 5.5.9+dfsg-1ubuntu4 (I think there's a .9 that's truncated), which I believe is the version of the metapackage and not necessarily the version of the extension:

$ dpkg -l php5-mysql
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                          Version             Architecture        Description
+++-=============================-===================-===================-================================================================
ii  php5-mysql                    5.5.9+dfsg-1ubuntu4 amd64               MySQL module for php5

Upvotes: 2

Views: 5379

Answers (2)

Dipak Ratnani
Dipak Ratnani

Reputation: 21

i found your answer just visit

http://php.net/manual/en/mysqli.get-server-version.php

put your database mysqli_connect link identifier without using database name

printf(mysqli_get_server_version($link));

Here as o/p 50617 so our version is 5.6.7

Upvotes: 0

Avinash
Avinash

Reputation: 6174

You can try below: http://php.net/manual/en/reflectionextension.getversion.php

$ext = new ReflectionExtension('mysqli');
var_dump($ext->getVersion());
// Output: string(3) "0.1"

Upvotes: 2

Related Questions