我有一个 PHP 应用程序,它需要独立于包含的 Apache 服务器执行 HTTP Basic 身份验证。
在 linux 机器上,通过 php 安装apt-get php,我发现Authorization标题没有出现在 中$_SERVER,但可以通过apache_request_headers()or获得getallheaders()。
在使用 Zend Server 6.1.0 / PHP 5.4 的 Windows 开发机器上,我无法Authorization通过上述任何方法从 PHP 内部获取标头值。我怎样才能得到它的价值?
mod_fcgid?
我无法确定它,但似乎 Zend Server 可能使用 FCGI 将 Apache 请求分派给 PHP(例如,变量PHP_FCGI_MAX_REQUESTS出现在 中$_SERVER)。
如果这是真的,它将解释我的问题,因为mod_fcgid故意Authorization从应用程序中保留标题,请参阅http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html#fcgidpassheader
我尝试添加
FcgidPassHeader Authorization
到我的 apache httpd.conf,但它只是抱怨:
Invalid command 'FcgidPassHeader', perhaps misspelled or defined by a module not included in the server configuration
mod_fastcgi?
同样,也许 Zend 正在使用mod_fastcgi? 基于此页面http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html#FastCgiConfig我尝试将以下内容添加到我的 apache 中httpd.conf:
FastCgiConfig -pass-header Authorization
再次,它只是抱怨:
Invalid command 'FastCgiConfig', perhaps misspelled or defined by a module not included in the server configuration