Author Topic: "could not find driver" error  (Read 4130 times)

0 Members and 2 Guests are viewing this topic.

Offline mikerodentTopic starter

  • Irregular
  • Posts: 2
    • View Profile
"could not find driver" error
« on: December 20, 2009, 11:51:05 AM »
Hi all,

(tried a forum search with the title of this posting ... came up with nothing)

I am getting a web server and stuff together on my machine.  Details:

OS: WXP, apache: 2.2.14, php: 5.3.1, mysql: 5.1.41, browser: Firefox 3.5.6.

my php/Apache is working fine... I encounter a problem when I try to get my php to connect to a database - on running a php file with the following line:

$dbh = new PDO("mysql:host=localhost; dbname=noggindb", "root", "twiddle" );

... I get the following response

exception 'PDOException' with message 'could not find driver' in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\noggindb\index.php:10 Stack trace: #0 C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\noggindb\index.php(10): PDO->__construct('mysql:host=loca...', 'root', 'twiddle') #1 {main}

... anyone know what this is about?  Do you have to explicitly set up a MySQL driver?  I haven't seen this in my installation instructions (sitewizard.com)...  I assumed one of the .dll files was a driver... php_mysql.dll, or php_mysqli.dll or libmySQL.dll... the latter file is in my MySQL\bin directory... I can't remember whether I copied it there or what...

Any advice? Thanks

Offline jskywalker

  • Enthusiast
  • Posts: 289
  • Gender: Male
    • View Profile
Re: "could not find driver" error
« Reply #1 on: January 16, 2010, 04:39:59 AM »
Look at the results op phpinfo();, and if there is a section named "PDO" in there..

If not, read http://php.net/manual/en/ref.pdo-mysql.php to see how to enable the PDO-extension on your PHP-installation.