Php – Uncaught Zend_Db_Adapter_Exception: The thesql driver is not currently installed

PHPredhatrhel6

I have RHEL 6.8 and I am installing PHP 7.1.3 from a repository remi-php71. I have installed PHP, but I also needed some extra modules, one of these is php_mysql. The repository remi-php71 provided a package: php-mysqlnd. But no php_mysql. Reading about mysqlnd, I found it right to install php_mysqlnd, instead of 'php_mysql' (which was anyway not available in the repo).

But in spite of having php_mysqlnd installed. I get these apache logs: "Uncaught Zend_Db_Adapter_Exception: The mysql driver is not currently installed in /usr/share/php/Zend/Db/Adapter/Pdo/Abstract.php:112…..".

The list of PHP packages I have installed:

  1. php-cli-7.1.3-1.el6.remi.x86_64
  2. php-process-7.1.3-1.el6.remi.x86_64
  3. php-mcrypt-7.1.3-1.el6.remi.x86_64
  4. php-ZendFramework-Db-Adapter-Pdo-Mysql-1.12.20-1.el6.remi.noarch
  5. php-common-7.1.3-1.el6.remi.x86_64
  6. php-7.1.3-1.el6.remi.x86_64
  7. php-pdo-7.1.3-1.el6.remi.x86_64
  8. php-xml-7.1.3-1.el6.remi.x86_64
  9. php-bcmath-7.1.3-1.el6.remi.x86_64
  10. php-ZendFramework-1.12.20-1.el6.remi.noarch
  11. php-ZendFramework-Db-Adapter-Pdo-1.12.20-1.el6.remi.noarch
  12. php-json-7.1.3-1.el6.remi.x86_64
  13. php-opcache-7.1.3-1.el6.remi.x86_64
  14. php-pear-1.10.3-1.el6.remi.noarch
  15. php-mysqlnd-7.1.3-1.el6.remi.x86_64

Can you please point in the right direction? I have seen this, couldn't find it useful in my case.

Best Answer

1/ mysql extension is deprecated for years and removed from PHP 7

2/ the php-mysqlnd package provides 3 extensions

Is seems you are still using ZF1, which is terrible old, and very probably not compatible with recent PHP versions. For new development, you should really consider using ZF 2 or ZF 3.

From above error message, you probably need pdo_mysql, so php-mysqlnd should be enough.

As a workaround you can use php-pecl-mysql which provides the old extension (but this is really a workaround, this extension is only provided for legacy app, and will probably be never released as "stable")