$ _SERVER ['PHP_AUTH_USER']为空 [英] $_SERVER['PHP_AUTH_USER'] is empty
问题描述
我试图更新VPS的php版本,但是它不起作用,并且我的提供者也不能很好地帮助我,因此我将其降级为以前的版本.
I tried to update the php version of my VPS but it didn't work and my provider didn't help me well, so i downgrade it to the previous version.
我现在正在使用PHP 5.2.17(cli).在此版本中,一切正常.
I am now working with PHP 5.2.17 (cli). Everything was working properly in this version.
由于此次升级和降级,因此变量$_SERVER['PHP_AUTH_USER']
为空. (在php.ini中,register_globals
为'on'并且$_SERVER['PHP_SELF']
正常工作).
Since this upgrade and downgrade, the variable $_SERVER['PHP_AUTH_USER']
is empty. (In the php.ini, register_globals
is 'on' and $_SERVER['PHP_SELF']
is properly working).
它正确地问我我的用户名和密码,并且我可以成功连接,但是我需要使用$_SERVER['PHP_AUTH_USER']
.
It ask me properly my username and password and i success to connect but i need to use $_SERVER['PHP_AUTH_USER']
.
我尝试了$_SERVER['PHP_AUTH_USER']
,$_SERVER['AUTH_USER']
,$_SERVER['REMOTE_USER']
螺母,但均无法正常工作. (但我从未收到任何错误,只是一个空值...)
I tried $_SERVER['PHP_AUTH_USER']
, $_SERVER['AUTH_USER']
, $_SERVER['REMOTE_USER']
nut none is working. (but im never getting any error, just a blank value...)
推荐答案
多亏了'mbinette',我终于找到了答案.
I finally found the answer thanks to 'mbinette'.
在我的PHP配置中,PHP 5的处理程序是CGI,这种身份验证不适用于PHP CGI.所以我将其更改为suPHP(应该是APACHE上的默认设置).
In my PHP configuration, the handler of PHP 5 was CGI, and this type of authentication doesn't work with PHP CGI. So i changed it to suPHP (which is supposed to be the default one on APACHE).
在此处查找帖子,说明了使用CGI和PHP_AUTH的方法,但是我尝试过,但是没有用.
Find here a post explaining a way to use CGI and PHP_AUTH, but i tried and it wasn't working.
在此处查找有关php处理程序的一些解释
Find here some explanations about php handlers
这篇关于$ _SERVER ['PHP_AUTH_USER']为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!