如何从php(其他计算机)连接到sql server


How to connect to sql server from php (other computer)

我安装了一台计算机sql server 2005
和其他计算机安装xampp v3.2.1
我试图通过php在计算机安装xampp中连接到sqlserver2005,但没有工作。

在计算机安装示例:

我从以下位置下载适用于php的驱动程序3.0http://www.microsoft.com/en-us/download/details.aspx?id=20098

并将2个文件php_sqlsrv_54_ts.dllphp_pdo_sqlsrv_54_ts.dll复制到Xampp'php'ext
我将下面的代码添加到php.ini 中

[sqlsrv]
sqlsrv.LogSubsystems=-1
sqlsrv.LogSeverity=-1
sqlsrv.WarningsReturnAsErrors=0
extension=php_sqlsrv_54_ts.dll
extension=php_pdo_sqlsrv_54_ts.dll

i通过测试连接

$serverName = "nameserver";
$connectionInfo = array("Database"=>"namedatabase");
$conn = sqlsrv_connect($serverName, $connectionInfo);
if ($conn) {
    echo "success";
}else {
    die (print_r(sqlsrv_errors(),true));
}

但是我得到错误

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 ) ) 

如何从php连接到sql服务器。感谢

检查错误消息中的"此扩展需要Microsoft SQL Server 2012 Native Client"。该客户端是您安装的额外软件,您可以从Microsoft下载安装程序。

我不确定这是否适用于SQLServer2005?