Question

After replacing mysql with mariadb, I encountered the following error:

PHP Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' in /var/www/inlcude/config.php:5\nStack trace:\n#0 /var/www/inlcude/config.php(5): PDO->__construct('mysql:dbname=my...', 'apache', 'ABCDE...')\n#1 /var/www/html/index(21): require('/var/www/inlcude/con...')\n#2 {main}\n thrown in /var/www/inlcude/config.php on line 5

I have read through the following two related questions, but can't find the answer there:
PDO and MariaDB
PDOException “could not find driver”

yum list pdo_mysql, yum list php5-mysql, yum list php5-mariadb all returns no matching package. What is the name of the PDO driver for mariadb to be used on Fedora 20 (red hat)?

Just to add, php-pdo is already installed.

Was it helpful?

Solution

By trial and error, it turns out that I need to install mysqlnd to get the PDO driver.

yum install php-mysqlnd

Don't ask me why or how it works because I have absolutely no idea.

OTHER TIPS

MarriaDB is branch of mysql. For installation PDO driver for it, install php-pdo and php-mysql packages

wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm

And after this you can install pdo and mysql from remi repositories

yum --enablerepo=remi install php-pdo
yum --enablerepo=remi install php-mysql
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top