SQLSRV 驱动程序已安装,但在使用 PHP 连接到 MSSQL 2008 R2 db 时显示错误


SQLSRV driver installed but shows error while connecting to MSSQL 2008 R2 db using PHP

我有一台运行Windows 7 Professional,MSSQL 2008 R2和IIS 7.5的笔记本电脑。该系统使我在 c# 和 php 中的所有应用程序都成功运行。现在我想在第二台装有Windows 7旗舰版的笔记本电脑上传输我的所有文件和应用程序。但是由于某种原因,即使phpinfo((显示安装了sqlsrv,并且我只是使用完全相同的代码只是更改数据库的连接字符串,我也无法成功连接到我的数据库。

我有 MSSQL 管理工作室 v 10.50.2500
IIS v 7.5.7600.16385
PHP v 5.5.3
适用于php 5.5的SQLSRV驱动程序(它不是官方的MS版本,但它非常受欢迎并且可以在我以前的笔记本电脑上运行(

我收到类似这样的错误:


    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代码如下(我知道它适用于第一台笔记本电脑(:


    `$serverName = "DELL-PC"; //serverName'instanceName`
    ``
    `$connectionInfo = array( "Database"=>"amlTest");`
    `$conn = sqlsrv_connect( $serverName, $connectionInfo);`

只是无法弄清楚问题是什么或我错过了哪里?我真的需要这个工作!!并且花了太多时间重新安装我的所有软件并尝试所有PHP版本。
我希望不是因为Windows版本的差异

另外,如果我在格式化问题时犯了任何错误,很抱歉,因为这是我的第一篇文章。

您是否安装了功能包?

http://microsoft.com/en-us/download/details.aspx?id=29065

错误的提示告诉我们,您需要 MS SQL Server 的 2012 版本才能正常工作。还要确保您的服务器权限设置正确。