php -i | grep API
Server API => Command Line Interface
PHP API => 20090626
Zend Extension Build => API220090626,NTS
PHP Extension Build => API20090626,NTS
DOM/XML API Version => 20031129
API Version => 3001
MHASH API Version => Emulated Support
Client API version => 5.3.12-MariaDB
Client API library version => 5.3.12-MariaDB
Client API header version => 5.5.46-MariaDB
Client API version => 5.3.12-MariaDB
Phar API version => 1.1.1
Client API library version & Client API header version are different and this caused the issue, both should be in the same version to avoid this issue. Most times we run easyapache twice, first by disabling the mysqli and second by re-enabling it and that didn’t rectify the issue in almost all cases.
Got a fix for this, the custom compiled php should be disabled with php-mysql extension and enabled with php-mysqlnd extension( THIS IS IN CASE FOR DOMAINS RUNNING VIA CUSTOM COMPILED PHP AND MARIADB). As a fix, I have re-compiled php-5.4 WITH the option ‘–enable-mysqlnd’ and WITHOUT ‘–with-mysql’ and the result is pasting below.
=====================================
root@techflavourz [/usr/local/php-5.4.25new/bin]# /usr/local/php-5.4.25new/bin/php -ini | grep API
Client API library version => 5.5.42-MariaDB
Client API header version => 5.5.42-MariaDB
=====================================
For default version
While recompiling apache/php via easyapache, we get 3 options for MySQL in the php modules selection section, pasting below the details.
==================================
Mysql – compile MySQL support using the PHP bundled libraries
Mysql of the system – compile mysql (and mysqli if its checked) support against the system libraries. If MySQL of the System is enabled, the system uses the libmysqlclient library and also takes precedence over the mysql module and making mysql module dont have any importance.
MySQL “Improved” extension – MySQLi does not replace the standard MySQL extension
==================================
In mariadb servers, if the mysql of the system is enabled, the mysql will get compiled with php using the libmysqlclient library, making the php-mysql ineffective and not getting compiled with mariadb libraries. This creates the Header / client library version mismatch.
To rectify this issue, just run the easyapache, selecting mysql and mysqli only and not with the “mysql of the system”, then the mysql will get compiled with mariadb libraries not with the system libraries. Result of that is pasting below.
==================================
# php -ini | grep API
Server API => Command Line Interface
DOM/XML API Version => 20031129
Client API version => 5.5.40-MariaDB
Client API library version => 5.5.40-MariaDB
Client API header version => 5.5.40-MariaDB
==================================
Run easyapache