【发布时间】:2016-07-08 00:37:30
【问题描述】:
我正在使用以下代码尝试连接:
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;
}
这是我的错误:
Failed to get DB handle: could not find driver
并且DLL Files已经在php/ext中并在php.ini
中修改我还能做什么?
【问题讨论】:
-
您是否尝试过重启您的网络服务器?
-
是的,但它仍然是同样的问题。
-
已启用 PDO 驱动程序
-
试试这个代码:
echo "<pre>", print_r(PDO::getAvailableDrivers()), "</pre>";这样你就可以看到什么驱动程序可用..
标签: php sql-server xampp