gpt4 book ai didi

php - 无法在 IIS 上使用 PHP 连接到 MSSQL

转载 作者:行者123 更新时间:2023-12-04 06:27:48 24 4
gpt4 key购买 nike

我已经在寻找解决方案 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 设置有关吗?还安装了另一个 native 客户端,但我无法从该实时服务器中删除它。

如何阅读这些信息? php sqlsrv 驱动程序是否可以看到 native 客户端?

编辑

问题是我使用的所有东西都是 32 位的。 native 驱动程序也显示在 ODBC 控制面板中。 PHP 的 Sqlsrv 扩展也如 phpinfo 所示工作。

PHP 的 sqlsrv 扩展怎么可能看不到 native 客户端?

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

最佳答案

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

关于php - 无法在 IIS 上使用 PHP 连接到 MSSQL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5820724/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com