简体   繁体   English

PHP连接“无法获取数据库句柄:找不到驱动器”

[英]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 DLL文件已经在php / ext中,并在php.ini中进行了修改

What else can I do? 我还可以做些什么?

There is following of possibility here, 这里有可能,

  1. enable mssql in php.ini 在php.ini中启用mssql

    ;extension=php_mssql.dll

    to extension=php_mssql.dll extension=php_mssql.dll

  2. try editing your setting at the php.ini mssql.secure_connection must be set to on . 尝试在php.ini上编辑设置, mssql.secure_connection必须设置为on mssql_connect can use secured connection if php is configured ... go into the php.ini and verify the mssql.secure_connection parameter 如果配置了php,则mssql_connect可以使用安全连接...进入php.ini并验证mssql.secure_connection参数

    [MSSQL] mssql.secure_connection = On 3.Try this: [MSSQL] mssql.secure_connection = On 3。尝试以下操作:

Uncomment the following in php.ini by removing the ";" 通过删除“;”在php.ini中取消注释以下内容:

;extension=php_pgsql.dll

I hope this will help you. 我希望这能帮到您。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 PHP SQLSRV连接“无法获取数据库句柄:找不到驱动器” - PHP SQLSRV connection “Failed to get DB handle: could not find driver” CDbConnection无法打开数据库连接:在Yii中找不到驱动程序 - CDbConnection failed to open the DB connection: could not find driver in Yii yii CDbException:CDbConnection 无法打开数据库连接:找不到驱动程序 - yii CDbException: CDbConnection failed to open the DB connection: could not find driver PDOException-连接失败-找不到驱动程序-PHP5 / SQLite / Ubuntu - PDOException - Connection Failed - Could not find driver - PHP5/SQLite/Ubuntu 尝试生成模型类时,“ CDbConnection无法打开数据库连接:找不到驱动程序” - 'CDbConnection failed to open the DB connection: could not find driver' while trying to generate a model class Yii 1.1.x CDbHttpSession错误:CDbConnection无法打开数据库连接:找不到驱动程序 - Yii 1.1.x CDbHttpSession error: CDbConnection failed to open the DB connection: could not find driver CDbConnection无法打开数据库连接:在Yii中使用ORACLE数据库时找不到驱动程序 - CDbConnection failed to open the DB connection: could not find driver while using ORACLE database in Yii Yii CDbConnection无法打开数据库连接:找不到google cloud sql的驱动程序 - Yii CDbConnection failed to open the DB connection: could not find driver with google cloud sql PHP PDO和oracle db“找不到驱动程序” - PHP PDO and oracle db “could not find driver” 使用PDO的MS Access PHP连接“找不到驱动程序”错误 - MS Access PHP Connection using PDO “could not find driver” error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM