What PDO driver to use with mariadb?

Question Overflow picture Question Overflow · Jan 3, 2014 · Viewed 24.4k times · Source

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.

Answer

Question Overflow picture Question Overflow · Jan 3, 2014

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.