问题描述
我在做用PHP编写一些自定义的身份验证和需要设置REMOTE_USER变量,并坚持下去,为Web服务器上的其他应用程序。
I'm doing some custom authentication written in PHP and need to set the REMOTE_USER variable, and make it stick, for use in other applications on the web server.
我能够将 REMOTE_USER
变量和 $ _ SERVER
显示它,并用 apache_setenv()
,但的phpinfo()在第二页
呼叫没有列出变量被设置。
I'm able to set the REMOTE_USER
variable and display it in $_SERVER
, and used apache_setenv()
, but a phpinfo()
call in a second page doesn't list the variable as being set.
Web服务器就是Apache 2和PHP 5有什么想法?
The web server is Apache 2 with PHP 5. Any thoughts?
附录:一个例子的情况是我验证对数据库表中的用户,并设置 REMOTE_USER
变量它们,然后通过代理将它们发送到另一台服务器,传递 REMOTE_USER
沿代理,这里描述为一个系统:
Addendum: An example situation would be I authenticate a user against a database table and set the REMOTE_USER
variable for them and then send them via proxy to a second server, passing REMOTE_USER
along the proxy, as described here for one system:
的
推荐答案
不要使用 $ _ SERVER
。该变量是从托管PHP服务器的人口,而不是你应该搞乱。
Don't use $_SERVER
. That variable is populated from the server hosting PHP, and isn't something you should be messing with.
什么你要找的是 $ _ SESSION
。
这篇关于如何使REMOTE_USER粘在PHP中设置的时候?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!