HQXU85
HQXU85

Reputation: 163

Trying to connect PDO on a local server

I am trying to connecting PDO on my local server. I'm using Windows 7 Professional 64-bit and have AppServ installed. In a php document I use the following code for connection:

<?php
$dbh = new PDO('mysql:host=localhost;dbname=test', 'root', 'password');
?>

But the code turns out to be an error: Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' in C:\AppServ\www\a.php:2

I checked phpinfo() and it shows that sqlite and sqlite2 are the only two databases installed in PDO. So how can I install MySQL PDO?

Upvotes: 1

Views: 1423

Answers (1)

HQXU85
HQXU85

Reputation: 163

Thank you all. I just removed the semicolon in the php.ini file for MySQL and it works! The default location of php.ini file is in C:/Windows/.

Upvotes: 1

Related Questions