PDO: Connection failed: could not find driver

小弟用緊
PHP/5.2.6

係phpinfo()入面都有講我開左pdo既dll

PDO

PDO support        enabled
PDO drivers        sqlite, sqlite2

仲有php.ini
extension=php_pdo.dll
extension=php_pdo_firebird.dll
extension=php_pdo_informix.dll
extension=php_pdo_mssql.dll
extension=php_pdo_mysql.dll
extension=php_pdo_oci.dll
extension=php_pdo_oci8.dll
extension=php_pdo_odbc.dll
extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
有關pdo既都DEL左";"

php code:

<?php

        $servename = "localhost";
        $username = "root";
        $password = "1233456";
       
        try{
                $conn = new PDO("mysql:host=$servername;dbname=myDB",
                $username, $password);
                $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
                echo "Connected successfully";
               
               
        }
        catch(PDOException $e){
                echo "Connection failed: " . $e->getMessage();
               
       
       
       

?>

有restart apache

但係都用唔到pdo連接mysql
有冇師兄可以幫下我:(

無野了, 成功用其他方法搞掂左, thx

TOP