我有一个PHP应用程序,需要独立于包含的Apache服务器执行HTTP基本身份验证。
在安装了通过apt-get php
的php的linux机器上,我发现Authorization
标头不会出现在$_SERVER
中,但可以通过apache_request_headers()
或getallheaders()
获得。
在一个Windows开发机上,使用Zend Server 6.1.0 / PHP 5.4,我无法通过上述任何方法从PHP内部获取Authorization
标头的值。如何获取它的值?
mod_fcgid?
我还没有确定这一点,但似乎Zend Server可能使用FCGI将Apache请求分派给PHP(例如,在$_SERVER
中出现变量PHP_FCGI_MAX_REQUESTS
)。
如果是这样,这就解释了我的问题,因为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