【问题标题】:Is HTTP Authentication possible with PHP on IIS FastCGI?IIS FastCGI 上的 PHP 是否可以进行 HTTP 身份验证?
【发布时间】:2009-08-24 20:54:33
【问题描述】:

我刚刚从使用 php5isapi.dll 的 PHP 5.2.3 迁移到使用 FastCGI 和 php-cgi.exe 的 PHP 5.3.0。在这个网站上,我有一些用于 windows/ntlm/http 身份验证的钩子,它执行如下操作:

if(empty($_SERVER["REMOTE_USER"]))
{
 header("HTTP/1.1 401 Unauthorized"); 
 exit;
}
$winuser = $_Server["REMOTE_USER"];

//parse $winuser to make sure it is on my domain, and can login to the site.
//set a cookie specifying that this user is logged in
//redirect to site.

这在带有 isapi 的 PHP 5.2.3 下非常有效。现在我已经转移到 IIS6 上的 FastCGI,它坏了。它对我有用,但我在服务器上有管理员。没有管理员的人(大多数人)会看到以下一些变体:

FastCGI Error
The FastCGI Handler was unable to process the request. 
________________________________________
Error Details:
•   The FastCGI process exited unexpectedly 
•   Error Number: -1073741819 (0xc0000005). 
•   Error Description: Unknown Error 
HTTP Error 500 - Server Error.
Internet Information Services (IIS)

我尝试过浏览文档和日志文件,但似乎没有取得任何进展。我实际上并不希望使用远程用户名来访问我的 .php 文件,我只想获取名称并与我的数据库匹配。 anon 用户仍然应该是执行实际 php 的用户。

有什么线索吗?

【问题讨论】:

    标签: php iis fastcgi http-authentication


    【解决方案1】:

    取得了一些进展,但还没有真正的解决方案。

    1. 遵循此处的建议很有用:FastCGI Docs 尤其是安全建议部分。这使我的错误脱离了 FASTCGI 500 并进入了 php 错误日志。

    2. 似乎 PHP/IIS/FastCGI 希望通过任何用户尝试进行身份验证而不是匿名用户来访问会话目录(我的是 C:\PHP\Session)。

    3. 将该文件夹的“修改”权限设置为“所有用户”允许站点按需要工作。但是,我想知道这样做会造成多大的安全漏洞...

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-03-05
      • 2017-02-20
      • 2019-01-30
      • 1970-01-01
      • 1970-01-01
      • 2021-11-14
      • 2017-11-11
      • 1970-01-01
      相关资源
      最近更新 更多