当 XAMPP 作为服务运行时,Page 无法连接 ODBC 服务器(在 Windows Server 2008 上)


Page can't connect ODBC server, when XAMPP run as service (on Windows Server 2008)

当我将Apache(通过XAMPP)作为独立服务器(而不是服务)运行时,以下代码工作正常(用户名和密码已删除)

$server = "WMS";
$link  = odbc_connect($server,'','');
if (!$link) {
    die('Something went horribly wrong while connecting to MSSQL');
}else {echo('');}

但是,当我将 Apache 更改为作为 Windows 服务运行时,连接中断,我收到以下错误消息:

Warning: odbc_connect() [function.odbc-connect]: SQL error:
[Microsoft][ODBC Driver Manager] Data source name not found
and no default driver specified, SQL state IM002 in SQLConnect
in C:'xampp'htdocs'Dev'well.php on line 30.
Something went wrong while connecting to MSSQL

这是 Windows Server 2008 问题。

将 apache 作为服务运行意味着 windows 不再登录到 SQL 服务器,这是我的身份验证方法

将 SQL Server 切换到 SQL 和 Windows 身份验证意味着 Web 应用程序可以使用该行中提供的凭据登录

$link  = odbc_connect($server,'[username]','[password]');

只要他们与服务器设置的安全和登录部分中的用户匹配,并且这些用户被设置为 SQL 身份验证类型的用户