PDO connection MySQL Error
$dbms = ' MySQL ';
$dbName = ' Db_mrbook ';
$user = ' root ';
$pwd = ' 111 ';
$host = ' localhost ';
$DSN = "$dbms: host = $host;d bname = $dbName";
try{
$pdo = new PDO ($DSN, $user, $pwd);
echo "PDO link database succeeded";
}catch (Exception $e) {
echo $e->getmessage (). "
";
}
?>
Run-time display could not find driver
Modified extensions in Php.ini.dist and php.ini.recommended, removing Extension=php_mysql.dll, Extension=php_pdo.dll, and Extension=php_pdo_ Mysql.dll in front of the semicolon, restart Apache, or the same error, please greatly help
------Solution--------------------
Phpinfo () see if the load succeeds
------Solution--------------------
Take a look at the load configure file in Phpinfo () and see if the php.ini files are loaded.
------Solution--------------------
That's it.
PHP Code
PDOPDO Support enabled PDO drivers mysql, ODBC, SQLite pdo_mysqlpdo Driver for MySQL enabled Client API version
mysqlnd 5.0.8-dev-20102224-$Revision: 308673 $ pdo_odbcpdo Driver for ODBC (WIN32) enabled ODBC Connection Pooli NG enabled, strict matching pdo_sqlitepdo Driver for SQLite 3.x Enabled SQLite Library 3.7.4
------Solution--------------------
Whether you changed the php.ini is the Loaded Configuration File corresponding to the php.ini