我在将 PHP 与在远程计算机上运行的 SQL SERVER 2008 连接时遇到了困难。我有 php 版本 5.4.3 和 apache 2.2.22。我的计算机上已经运行了 SQL SERVER 2008。我的 wamp\bin\php\php5.4.3\ext 文件夹中包含以下文件:
- php_sqlsrv_54_ts.dll
- php_pdo_sqlsrv_54_ts.dll
在运行简单的代码时
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn )
{
echo "Connection established.\n";
}
else
{
echo "Connection could not be established.\n";
die( print_r( sqlsrv_errors(), true));
}
我收到以下错误:
Connection could not be established. Array (
[0] => Array (
[0] => IMSSP [SQLSTATE] => IMSSP
[1] => -49 [code] => -49
[2] => This extension requires the Microsoft SQL Server 2012 Native Client. Access the following URL to download the Microsoft SQL Server 2012 Native Client ODBC driver for x86: http://go.microsoft.com/fwlink/?LinkId=163712 [message] => This extension requires the Microsoft SQL Server 2012 Native Client. Access the following URL to download the Microsoft SQL Server 2012 Native Client ODBC driver for x86: http://go.microsoft.com/fwlink/?LinkId=163712
)
[1] => Array (
[0] => IM002 [SQLSTATE] => IM002
[1] => 0 [code] => 0
[2] => [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified [message] => [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
)
)
但我不知道为什么我被要求安装Microsoft SQL Server 2012 Native Client。
php我试过这个链接但没有成功。
提前致谢。
更新 1:
我下载了 php 5.3.1 并按照本教程操作,脚本就像一个魅力。