mehnihma

Well-Known Member
Dec 15, 2012
57
1
8
cPanel Access Level
Root Administrator
Hi
I am having problem activating PDO in PHP, I have recompiled with easyapache and it is loaded in php

But when I try to connect to database it gives me error: could not find driver

this is the script:
<?php
$hostname = "localhost";
$username = "example";
$password = "password";

try {
$db = new PDO("mysql:host=$hostname;dbname=ibaza", $username, $password);
echo "Connected to database";
}
catch(PDOException $e) {
echo $e->getMessage();
}

?>

I have recently updated MySQL to 5.6 and not sure why this happens. PDO is not working?



can you maybe help me?
 
Last edited by a moderator:
  • Like
Reactions: mauroya33

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,229
463
Hello :)

Could you upload a PHPINFO file to see if the PDO module for PHP is loaded properly? Also, does installing it as a PECL module make a difference? EX:

Code:
pecl install PDO_MySQL
Note: It looked like you posted the actual username/password combination used in your script configuration file. I updated it to use example entries, but if you did initially use the actual credentials, please consider those details exposed because this is a public forum.

Thank you.