简体   繁体   中英

PHP connection “Failed to get DB handle: could not find driver”

I'm using the following code to try and connect:

try {
        $hostname = "*****";
        $port = 1443;
        $dbname = "*******";
        $username = "********";
        $pw = "************";
        $dbh = new PDO ("dblib:host=$hostname:$port;dbname=$dbname","$username","$pw");
        } catch (PDOException $e) {
            echo "Failed to get DB handle: " . $e->getMessage() . "\n";
        exit;
        }

This is my Error:

Failed to get DB handle: could not find driver

And the DLL Files are already in the php/ext and modified in the php.ini

What else can I do?

There is following of possibility here,

  1. enable mssql in php.ini

    ;extension=php_mssql.dll

    to extension=php_mssql.dll

  2. try editing your setting at the php.ini mssql.secure_connection must be set to on . mssql_connect can use secured connection if php is configured ... go into the php.ini and verify the mssql.secure_connection parameter

    [MSSQL] mssql.secure_connection = On 3.Try this:

Uncomment the following in php.ini by removing the ";"

;extension=php_pgsql.dll

I hope this will help you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM