【发布时间】:2011-04-28 15:03:40
【问题描述】:
我已经在寻找解决方案 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 服务器上完全相同的配置,并将进行一些更大胆的实验。
【问题讨论】:
-
如果您使用的是 64 位 Windows 主机,请记住,32 位和 64 位 ODBC 控制面板都有不同的驱动程序。如果你的 PHP 是 32 位的,而你只有 64 位的 R2 驱动程序,那么 PHP 会认为没有驱动程序。
-
您需要安装 all 来自以下 1 个包的驱动程序:Driver pack for x86(32 位)。或 Driver pack for x64(64 位)。
-
您使用的是哪个版本的 sqlsrv PHP 扩展?即
PHP/ext/php_sqlsrv_xxx.dll文件的名称是什么?
标签: php sql-server iis odbc-sql-server-driver