"version libmysqlclient_18 not defined in file libmysqlclient.so.18" when loading mysqli extension

Jeff Long picture Jeff Long · Feb 4, 2013 · Viewed 8.2k times · Source

I recently switched from mysql 5.5 to mariadb 5.5, however it now seems the php extension for mysqli will not load. I get the following error:

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/mysqli.so' - /usr/lib/php/modules/mysqli.so: symbol mysql_client_errors, version libmysqlclient_18 not defined in file libmysqlclient.so.18 with link time reference in Unknown on line 0

I have checked my /usr/lib/mysql/ and have the following:

lrwxrwxrwx  1 root root      26 Jan  2 23:56 libmysqlclient_r.so.16 -> libmysqlclient_r.so.16.0.0
-rwxr-xr-x  1 root root 2140588 Dec 23  2010 libmysqlclient_r.so.16.0.0
lrwxrwxrwx  1 root root      24 Jan  2 23:56 libmysqlclient.so.16 -> libmysqlclient.so.16.0.0
-rwxr-xr-x  1 root root 2146532 Dec 23  2010 libmysqlclient.so.16.0.0
lrwxrwxrwx  1 root root      24 Feb  4 03:00 libmysqlclient.so.18 -> libmysqlclient.so.18.0.0
lrwxrwxrwx  1 root root      29 Feb  4 01:25 libmysqlclient.so.18.0.0 -> /usr/lib/libmysqlclient.so.18

And in /usr/lib/

-rw-r--r--  1 root root  3516274 Jan 29 17:50 libmysqlclient.a
lrwxrwxrwx  1 root root       16 Feb  4 03:50 libmysqlclient_r.a -> libmysqlclient.a
lrwxrwxrwx  1 root root       17 Feb  4 04:03 libmysqlclient_r.so -> libmysqlclient.so
lrwxrwxrwx  1 root root       26 Feb  4 03:00 libmysqlclient_r.so.15 -> libmysqlclient_r.so.15.0.0
-rwxr-xr-x  1 root root  1890068 Jan 29 17:49 libmysqlclient_r.so.15.0.0
lrwxrwxrwx  1 root root       26 Feb  4 03:00 libmysqlclient_r.so.16 -> libmysqlclient_r.so.16.0.0
-rwxr-xr-x  1 root root  2039444 Jan 29 17:49 libmysqlclient_r.so.16.0.0
lrwxrwxrwx  1 root root       17 Feb  4 04:03 libmysqlclient_r.so.18 -> libmysqlclient.so
lrwxrwxrwx  1 root root       17 Feb  4 04:03 libmysqlclient_r.so.18.0.0 -> libmysqlclient.so
lrwxrwxrwx  1 root root       20 Feb  4 04:03 libmysqlclient.so -> libmysqlclient.so.18
lrwxrwxrwx  1 root root       24 Feb  4 03:00 libmysqlclient.so.15 -> libmysqlclient.so.15.0.0
-rwxr-xr-x  1 root root  1881264 Jan 29 17:49 libmysqlclient.so.15.0.0
lrwxrwxrwx  1 root root       24 Feb  4 03:00 libmysqlclient.so.16 -> libmysqlclient.so.16.0.0
-rwxr-xr-x  1 root root  2029136 Jan 29 17:49 libmysqlclient.so.16.0.0
lrwxrwxrwx  1 root root       24 Feb  4 04:03 libmysqlclient.so.18 -> libmysqlclient.so.18.0.0
-rwxr-xr-x  1 root root  4572480 Jan 29 17:28 libmysqlclient.so.18.0.0
lrwxrwxrwx  1 root root       24 Feb  2 12:23 libmysqlclient.so.18.bak -> libmysqlclient.so.18.0.0
-rw-r--r--  1 root root 17728804 Jan 29 17:50 libmysqld.a
lrwxrwxrwx  1 root root       15 Feb  4 03:00 libmysqld.so -> libmysqld.so.18
-rwxr-xr-x  1 root root 51104132 Jan 29 17:48 libmysqld.so.18
-rw-r--r--  1 root root     5590 Jan 29 17:49 libmysqlservices.a

This is on CentOS 6.3

Answer

BraydenJW picture BraydenJW · Feb 10, 2013

I've been having the same problem as you and here is the solution I have come up with. I'm running CentOS 6.3 with MariaDB 5.5 and was running PHP 5.4.11, but in this solution I reverted to PHP 5.4.10. I'm by no means a Linux guru, so take what I'm saying with a grain of salt.

I managed to get MariaDB working fine with MySQLi and no longer receive this error by uninstalling PHP through yum. I then reinstalled it using the instructions given here http://www.webtatic.com/packages/php54/. The version of PHP I was having troubles with was PHP 5.4.11, and the version given in the RPM provided at this instruction site is version 5.4.10, so I'm thinking an update that was made in the new release broke something.

So try installing PHP 5.4.10 anyway you want and see if that works for you, or use the instructions from that website if it's easier for you. Remember to include "yum install php54w-mysql" as one of the packages you install, as well as any other one you may desire.