Edit report at https://bugs.php.net/bug.php?id=64032&edit=1
ID: 64032
Updated by: cmb@php.net
Reported by: shakaran at gmail dot com
Summary: mysqli reports different client_version with
procedural and object style
Status: Verified
Type: Bug
Package: MySQLi related
Operating System: Centos 5.9
PHP Version: 5.3.21
Block user comment: N
Private report: N
New Comment:
To clarify, this has nothing to do with the server (version); it's
rather about the difference of the version PHP (or the respective
extension) has been built against vs. which version is availble
during runtime.
Previous Comments:
------------------------------------------------------------------------
[2013-03-13 16:24:36] shakaran at gmail dot com
ext/mysqli/php_mysqli_structs.h:91:#define MYSQLI_VERSION_ID 101009
ext/mysqlnd/mysqlnd.h:26:#define MYSQLND_VERSION_ID 50011
ext/mysqlnd/mysqlnd_libmysql_compat.h:36:#define MYSQL_VERSION_ID
MYSQLND_VERSION_ID
------------------------------------------------------------------------
[2013-03-13 13:07:05] uw@php.net
s/MYSQLI_VERSION/MYSQL_VERSION_ID
------------------------------------------------------------------------
[2013-03-13 13:06:25] uw@php.net
Good find, must be a bug dating back years:
OO interfaces uses compile time MYSQLI_VERSION
Procedural interfaces uses run time C API function call
However, its slightly in the grey area. Client library version and server version are expected to
match in general. AFAIK, in the past, only very conservative statements have been made about using
library versions that differ from server version, particularily if using old library to connect to
new server - which seems to be your case.
------------------------------------------------------------------------
[2013-01-31 21:06:35] shakaran at gmail dot com
From Pierre Joye's twitter suggestion I add this info. I am using libmysql (no
mysqlnd). It is the default shipped with cPanel in CentOs with easyapache
script.
Some additional info:
# php -i | grep mysql
Configure Command => './configure' '--enable-bcmath'
'--enable-calendar' '--
enable-exif' '--enable-ftp' '--enable-gd-native-ttf'
'--enable-intl' '--enable-
libxml' '--enable-magic-quotes' '--enable-mbstring'
'--enable-pdo=shared' '--
enable-safe-mode' '--enable-soap' '--enable-sockets'
'--enable-wddx' '--enable-
zend-multibyte' '--enable-zip' '--prefix=/usr/local' '--with-
apxs2=/usr/local/apache/bin/apxs' '--with-bz2' '--with-config-file-
path=/usr/local/lib' '--with-config-file-scan-dir=/usr/local/lib/php.ini.d' '--
with-curl=/opt/curlssl/' '--with-curlwrappers' '--with-enchant=/usr'
'--with-
freetype-dir=/usr' '--with-gd' '--with-gettext'
'--with-icu-dir=/usr' '--with-
imap=/opt/php_with_imap_client/' '--with-imap-ssl=/usr'
'--with-jpeg-dir=/usr'
'--with-kerberos' '--with-libdir=lib64' '--with-libexpat-dir=/usr'
'--with-
libxml-dir=/opt/xml2' '--with-libxml-dir=/opt/xml2/' '--with-
mcrypt=/opt/libmcrypt/' '--with-mm=/opt/mm/' '--with-mysql=/usr'
'--with-mysql-
sock=/var/lib/mysql/mysql.sock' '--with-mysqli=/usr/bin/mysql_config' '--with-
openssl=/usr' '--with-openssl-dir=/usr' '--with-pcre-regex=/opt/pcre'
'--with-
pdo-mysql=shared' '--with-pdo-sqlite=shared' '--with-pic'
'--with-png-dir=/usr'
'--with-pspell' '--with-sqlite=shared' '--with-tidy=/opt/tidy/'
'--with-xmlrpc'
'--with-xpm-dir=/usr' '--with-xsl=/opt/xslt/' '--with-zlib'
'--with-zlib-
dir=/usr'
mysql
MYSQL_SOCKET => /var/lib/mysql/mysql.sock
MYSQL_INCLUDE => -I/usr/include/mysql
MYSQL_LIBS => -L/usr/lib64 -lmysqlclient
mysql.allow_local_infile => On => On
mysql.allow_persistent => On => On
mysql.connect_timeout => 60 => 60
mysql.default_host => no value => no value
mysql.default_password => no value => no value
mysql.default_port => no value => no value
mysql.default_socket => /var/lib/mysql/mysql.sock => /var/lib/mysql/mysql.sock
mysql.default_user => no value => no value
mysql.max_links => Unlimited => Unlimited
mysql.max_persistent => Unlimited => Unlimited
mysql.trace_mode => Off => Off
mysqli
MYSQLI_SOCKET => /var/lib/mysql/mysql.sock
mysqli.allow_local_infile => On => On
mysqli.allow_persistent => On => On
mysqli.default_host => no value => no value
mysqli.default_port => 3306 => 3306
mysqli.default_pw => no value => no value
mysqli.default_socket => /var/lib/mysql/mysql.sock => /var/lib/mysql/mysql.sock
mysqli.default_user => no value => no value
mysqli.max_links => Unlimited => Unlimited
mysqli.max_persistent => Unlimited => Unlimited
mysqli.reconnect => Off => Off
PDO drivers => sqlite, sqlite2, mysql
pdo_mysql
pdo_mysql.default_socket => /var/lib/mysql/mysql.sock =>
/var/lib/mysql/mysql.sock
# ldd /usr/local/lib/php/extensions/no-debug-non-zts-20090626/pdo_mysql.so
linux-vdso.so.1 => (0x00007fffb9d03000)
libmysqlclient.so.18 => /usr/lib64/libmysqlclient.so.18
(0x00002ac356f05000)
libm.so.6 => /lib64/libm.so.6 (0x00002ac357469000)
librt.so.1 => /lib64/librt.so.1 (0x00002ac3576ed000)
libdl.so.2 => /lib64/libdl.so.2 (0x00002ac3578f6000)
libc.so.6 => /lib64/libc.so.6 (0x00002ac357afa000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00002ac357e54000)
/lib64/ld-linux-x86-64.so.2 (0x00000030ed200000)
------------------------------------------------------------------------
[2013-01-21 01:37:43] shakaran at gmail dot com
Additionally using mysqli_init() has the same behaviour.
# php -r '$mysqli = mysqli_init(); var_dump($mysqli->client_version);
var_dump(mysqli_get_client_version());' ; mysql --version; php --version
int(50524)
int(50528)
mysql Ver 14.14 Distrib 5.5.28, for Linux (x86_64) using readline 5.1
PHP 5.3.15 (cli) (built: Aug 9 2012 07:10:41)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
with eAccelerator v0.9.6.1, Copyright (c) 2004-2010 eAccelerator, by
eAccelerator
with the ionCube PHP Loader v4.2.2, Copyright (c) 2002-2012, by ionCube
Ltd., and
with Zend Guard Loader v3.3, Copyright (c) 1998-2010, by Zend Technologies
with Suhosin v0.9.33, Copyright (c) 2007-2012, by SektionEins GmbH
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=64032
--
Edit this bug report at https://bugs.php.net/bug.php?id=64032&edit=1