10
已经下载了微软的SQLSRV ...此扩展需要Microsoft ODBC驱动程序11 SQL Server和SQL Server进行通信
,并在我的phpinfo()
启用php.ini
两个C:\wamp\bin\apache\apache2.4.9\bin
和C:\wamp\bin\php\php5.5.12
仍然有这样的错误。
Failed to get DB handle: SQLSTATE[IMSSP]: This extension requires the Microsoft ODBC Driver 11 for SQL Server to communicate with SQL Server. Access the following URL to download the ODBC Driver 11 for SQL Server for x86: http://go.microsoft.com/fwlink/?LinkId=163712
和我的代码是
try {
$dbh = new PDO ("sqlsrv:Server=$host;Database=$db","$user","$pass");
} catch (PDOException $e) {
echo "Failed to get DB handle: " . $e->getMessage() . "\n";
exit;
}
$stmt = $dbh->prepare("select top 5 from teams");
$stmt->execute();
while ($row = $stmt->fetch()) {
print_r($row);
}
unset($dbh); unset($stmt);
“驱动程序11”。你有没有检查你实际安装的版本?只有一个sqlserver驱动程序意味着什么。 –
@MarcB你是什么意思?在哪里检查它? –