2

我已经在寻找解决方案 2 天了。我得到以下效果:

   array(2) {
  [0] => array(6) {
    [0] => string(5) "IMSSP"
    ["SQLSTATE"] => string(5) "IMSSP"
    [1] => int(-49)
    ["code"] => int(-49)
    [2] => string(390) "This extension requires either the Microsoft SQL Server 2008 Native Client (SP1 or later) or the Microsoft SQL Server 2008 R2 Native Client ODBC Driver to communicate with SQL Server.  Neither of those ODBC Drivers are currently installed. Access the following URL to download the Microsoft SQL Server 2008 R2 Native Client ODBC driver for x86: http://go.microsoft.com/fwlink/?LinkId=163712"
    ["message"] => string(390) "This extension requires either the Microsoft SQL Server 2008 Native Client (SP1 or later) or the Microsoft SQL Server 2008 R2 Native Client ODBC Driver to communicate with SQL Server.  Neither of those ODBC Drivers are currently installed. Access the following URL to download the Microsoft SQL Server 2008 R2 Native Client ODBC driver for x86: http://go.microsoft.com/fwlink/?LinkId=163712"
  }
  [1] => array(6) {
    [0] => string(5) "IM002"
    ["SQLSTATE"] => string(5) "IM002"
    [1] => int(0)
    ["code"] => int(0)
    [2] => string(91) "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"
    ["message"] => string(91) "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"
  }
}

看起来没有“Microsoft SQL Server 2008 R2 Native Client”,但有!

我已经在本地机器和测试服务器上使用了相同的配置。当没有安装“Microsoft SQL Server 2008 R2 Native Client”时,我在本地机器上遇到了同样的错误。安装后问题就解决了。

不幸的是,我在这里看不到任何变化。

我正在尝试不同的 PHP 和 sqlsrv 驱动程序,但没有效果。

我不能体验很多,因为这是实时服务器。

我怎样才能使它工作?这与控制面板 ODBC 设置有关吗?还安装了另一个本机客户端,但我无法从该实时服务器中删除它。

如何阅读这些信息?php sqlsrv 驱动程序是否完全看到本机客户端?

编辑

问题是我正在使用 32 位的所有内容。本机驱动程序也显示在 ODBC 控制面板中。PHP 的 Sqlsrv 扩展也可以正常工作,如 phpinfo 中所示。

PHP的sqlsrv扩展怎么可能没有“看到”那个本机客户端?

我无能为力,现在我正在设置 VM,我将在其中设置与 Web 服务器完全相同的配置,并将进行一些更大胆的实验。

4

2 回答 2

2

在服务器上安装 32 位和 64 位驱动程序。32 位 odbc 控制面板位于 Windows\SysWow64 目录中 - 不是很明显,但仅此而已。确保您有可执行文件 (PHP) 的驱动程序 - 如果它是 32 位,则需要 32 位驱动程序。

于 2011-04-28T19:55:02.250 回答
1

看来你和我这周遇到的问题一样

我下载了 Process Monitor 并按照这篇文章的说明进行操作

http://www.iislogs.com/articles/processmonitorw3wp/

然后我看到进程 w3wp.exe 在此注册表项上被拒绝访问

HKLM\Software\ODBC\ODBCINST.INI\SQL Native Client 10.0

我打开 RegEdit 并找到那个键。

我确实右键单击 - > 权限并将网络服务添加到列表中并赋予它读取权限。

回收了应用程序池,它现在可以工作了!

希望能帮助到你。

干杯,费德

于 2012-03-29T08:34:21.660 回答