Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PDOException “could not find driver”

Tags:

php

mysql

pdo

lamp

I have just installed Debian Lenny with Apache, MySQL, and PHP and I am receiving a PDOException could not find driver.

This is the specific line of code it is referring to:

$dbh = new PDO('mysql:host=' . DB_HOST . ';dbname=' . DB_NAME, DB_USER, DB_PASS)

DB_HOST, DB_NAME, DB_USER, and DB_PASS are constants that I have defined. It works fine on the production server (and on my previous Ubuntu Server setup).

Is this something to do with my PHP installation?

Searching the internet has not helped, all I get is experts-exchange and examples, but no solutions.

like image 847
Mike Moore Avatar asked May 17 '10 20:05

Mike Moore


1 Answers

You need to have a module called pdo_mysql. Looking for following in phpinfo(),

pdo_mysql  PDO Driver for MySQL, client library version => 5.1.44 
like image 128
ZZ Coder Avatar answered Sep 20 '22 11:09

ZZ Coder