Trying to install PHP MySQL driver with MariaDB already installed

John J. Camilleri asked:

I have a VPS which came from an image called CentOS 6.4 x64,Nginx,php-fpm,MariaDB.
PHP and MariaDB are both installed, but it seems that PHP does not have the MySQL driver installed. I first tried adding

extension=mysql.so

to my php.ini but that gives me the following error:

Starting php-fpm: [12-Dec-2013 17:23:27] NOTICE: PHP message: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/mysql.so' - /usr/lib64/php/modules/mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0

I then tried yum install php-mysql but get the following:

Resolving Dependencies
--> Running transaction check
---> Package php-mysql.x86_64 0:5.4.23-1.el6.remi will be installed
--> Processing Dependency: php-pdo(x86-64) = 5.4.23-1.el6.remi for package: php-mysql-5.4.23-1.el6.remi.x86_64
--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: php-mysql-5.4.23-1.el6.remi.x86_64
Package mysql-libs-5.5.35-1.el6.remi.x86_64 is obsoleted by MariaDB-shared-5.5.32-1.i386 which is already installed
--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_16)(64bit) for package: php-mysql-5.4.23-1.el6.remi.x86_64
Package mysql-libs-5.5.35-1.el6.remi.x86_64 is obsoleted by MariaDB-shared-5.5.32-1.i386 which is already installed
--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: php-mysql-5.4.23-1.el6.remi.x86_64
Package mysql-libs-5.5.35-1.el6.remi.x86_64 is obsoleted by MariaDB-shared-5.5.32-1.i386 which is already installed
--> Finished Dependency Resolution
Error: Package: php-mysql-5.4.23-1.el6.remi.x86_64 (remi)
           Requires: libmysqlclient.so.18()(64bit)
           Available: compat-mysql55-5.5.11-1.el6.remi.x86_64 (remi-test)
               libmysqlclient.so.18()(64bit)
           Available: compat-mysql55-5.5.34-1.el6.remi.x86_64 (remi-test)
               libmysqlclient.so.18()(64bit)
           Available: mysql-libs-5.5.34-1.el6.remi.x86_64 (remi)
               libmysqlclient.so.18()(64bit)
           Available: mysql-libs-5.5.35-1.el6.remi.x86_64 (remi)
               libmysqlclient.so.18()(64bit)
           Available: mysql-libs-5.1.71-1.el6.i686 (base)
               Not found
Error: Package: php-mysql-5.4.23-1.el6.remi.x86_64 (remi)
           Requires: libmysqlclient.so.18(libmysqlclient_16)(64bit)
           Available: compat-mysql55-5.5.11-1.el6.remi.x86_64 (remi-test)
               libmysqlclient.so.18(libmysqlclient_16)(64bit)
           Available: compat-mysql55-5.5.34-1.el6.remi.x86_64 (remi-test)
               libmysqlclient.so.18(libmysqlclient_16)(64bit)
           Available: mysql-libs-5.5.34-1.el6.remi.x86_64 (remi)
               libmysqlclient.so.18(libmysqlclient_16)(64bit)
           Available: mysql-libs-5.5.35-1.el6.remi.x86_64 (remi)
               libmysqlclient.so.18(libmysqlclient_16)(64bit)
           Available: mysql-libs-5.1.71-1.el6.i686 (base)
               Not found
Error: Package: php-mysql-5.4.23-1.el6.remi.x86_64 (remi)
           Requires: libmysqlclient.so.18(libmysqlclient_18)(64bit)
           Available: compat-mysql55-5.5.11-1.el6.remi.x86_64 (remi-test)
               libmysqlclient.so.18(libmysqlclient_18)(64bit)
           Available: compat-mysql55-5.5.34-1.el6.remi.x86_64 (remi-test)
               libmysqlclient.so.18(libmysqlclient_18)(64bit)
           Available: mysql-libs-5.5.34-1.el6.remi.x86_64 (remi)
               libmysqlclient.so.18(libmysqlclient_18)(64bit)
           Available: mysql-libs-5.5.35-1.el6.remi.x86_64 (remi)
               libmysqlclient.so.18(libmysqlclient_18)(64bit)
           Available: mysql-libs-5.1.71-1.el6.i686 (base)
               Not found
Error: Package: php-mysql-5.4.23-1.el6.remi.x86_64 (remi)
           Requires: php-pdo(x86-64) = 5.4.23-1.el6.remi
           Installed: php-pdo-5.5.0-1.el6.remi.x86_64 (@remi-test)
               php-pdo(x86-64) = 5.5.0-1.el6.remi
           Available: php-pdo-5.3.3-26.el6.x86_64 (base)
               php-pdo(x86-64) = 5.3.3-26.el6
           Available: php-pdo-5.3.3-27.el6_5.x86_64 (updates)
               php-pdo(x86-64) = 5.3.3-27.el6_5
           Available: php-pdo-5.4.22-1.el6.remi.x86_64 (remi)
               php-pdo(x86-64) = 5.4.22-1.el6.remi
           Available: php-pdo-5.4.23-1.el6.remi.x86_64 (remi)
               php-pdo(x86-64) = 5.4.23-1.el6.remi
 You could try using --skip-broken to work around the problem
** Found 3 pre-existing rpmdb problem(s), 'yum check' output follows:
2:postfix-2.6.6-2.2.el6_1.x86_64 has missing requires of libmysqlclient.so.16()(64bit)
2:postfix-2.6.6-2.2.el6_1.x86_64 has missing requires of libmysqlclient.so.16(libmysqlclient_16)(64bit)
2:postfix-2.6.6-2.2.el6_1.x86_64 has missing requires of mysql-libs

What should I do? Of course I don’t want to install MySQL itself, just the PHP driver.

Note: this is a cross-post from http://stackoverflow.com/questions/20561527/install-php-mysql-to-use-mariadb, but perhaps it is actually better suited here than StackOverflow

Update 1

After John’s suggestion, I tried yum install php-mysql --disablerepo=remi.
However this still gave me more problems:

Error: Package: php-mysql-5.3.3-27.el6_5.x86_64 (updates)
           Requires: libmysqlclient.so.16(libmysqlclient_16)(64bit)
           Available: mysql-libs-5.1.71-1.el6.x86_64 (base)
               libmysqlclient.so.16(libmysqlclient_16)(64bit)
Error: Package: php-mysql-5.3.3-27.el6_5.x86_64 (updates)
           Requires: libmysqlclient.so.16()(64bit)
           Available: mysql-libs-5.1.71-1.el6.x86_64 (base)
               libmysqlclient.so.16()(64bit)
Error: Package: php-mysql-5.3.3-27.el6_5.x86_64 (updates)
           Requires: php-common(x86-64) = 5.3.3-27.el6_5
           Installed: php-common-5.5.0-1.el6.remi.x86_64 (@remi-test)
               php-common(x86-64) = 5.5.0-1.el6.remi
           Available: php-common-5.3.3-26.el6.x86_64 (base)
               php-common(x86-64) = 5.3.3-26.el6
           Available: php-common-5.3.3-27.el6_5.x86_64 (updates)
               php-common(x86-64) = 5.3.3-27.el6_5

Update 2

If I try yum install php-mysqlnd then the dependency errors are reduced:

Error: Package: php-mysqlnd-5.4.23-1.el6.remi.x86_64 (remi)
           Requires: php-pdo(x86-64) = 5.4.23-1.el6.remi
           Installed: php-pdo-5.5.0-1.el6.remi.x86_64 (@remi-test)
               php-pdo(x86-64) = 5.5.0-1.el6.remi
           Available: php-pdo-5.3.3-26.el6.x86_64 (base)
               php-pdo(x86-64) = 5.3.3-26.el6
           Available: php-pdo-5.3.3-27.el6_5.x86_64 (updates)
               php-pdo(x86-64) = 5.3.3-27.el6_5
           Available: php-pdo-5.4.22-1.el6.remi.x86_64 (remi)
               php-pdo(x86-64) = 5.4.22-1.el6.remi
           Available: php-pdo-5.4.23-1.el6.remi.x86_64 (remi)
               php-pdo(x86-64) = 5.4.23-1.el6.remi

So all I need to find some source for php-mysqlnd 5.5 which apparently is not in available in remi-test. Any ideas where I can find this? I only want this particular package so maybe I should just download it and build from source?

My answer:


You installed PHP 5.5 from the remi-test repository, but you don’t seem to have this repo enabled anymore. This is why the wrong older version of php-mysql is being proposed for installation. Try enabling the remi-test repo.

yum --enablerepo=remi-test install php-mysql

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.