阿帕奇 - 如何获取REMOTE_USER变量 [英] Apache - how to get REMOTE_USER variable
问题描述
previously我用IIS服务器PHP服务器。目前,它是Apache。
在IIS我可以访问到变量 $ _ SERVER ['REMOTE_USER']
返回的用户名和域名(如域\\用户),但在安装XAMPP后,这个变量是不可用。
我应该怎么做才能得到这个变量爬不起来?
我的应用程序在本地网络上没有互联网连接。
最后它得到的作品! :D
-
从这里的 https://www.apachehaus.net/modules/mod_authnz_sspi/ (X86 32位和x64 64位阿帕奇)
-
复制从
Apache24 \\模块mod_authnz_sspi.so
文件夹,并将其放置在你的Apache文件夹的modules文件夹上你的服务器 -
在httpd.conf文件(你的Apache的配置文件)放置此行code的。尝试加载这个作为最后一个模块:
的LoadModule authnz_sspi_module模块/ mod_authnz_sspi.so
-
请确保以下模块都注释掉
的LoadModule authn_core_module模块/ mod_authn_core.so
的LoadModule authz_core_module模块/ mod_authz_core.so
PS:上述两个模块都需要这个工作。
-
将以下code在httpd.conf文件
<目录路径/要/你/ htcdocs /文件夹>
选择无
所有的AllowOverride
为了允许,拒绝
所有允许
#AuthNameSSPI保护的地方
AuthType选项SSPI
SSPIAuth在
SSPIAuthoritative在
SSPIOfferBasic在
SSPIOmitDomain在
需要有效的用户
< /目录>
块引用> -
重新启动你的apache servive,并希望它应该没有任何问题的重新启动。
- 现在,为了识别用户,请使用以下code PHP页面上
回声$ _ SERVER ['PHP_AUTH_USER'];
这就是全部。
块引用>
我使用的是:
- XAMPP控制面板3.2.1
- APACHE 2.4
Previously I used the IIS server as PHP server. Currently, it is the apache.
On IIS I could access to the variable $_SERVER ['REMOTE_USER']
which returns the username and domain (eg domain\user) but after installing XAMPP this variable is not available.
What I should do to get this variable get again?
My app is on local network with no-internet connection
Finally got it to works! :D
Download the module from here https://www.apachehaus.net/modules/mod_authnz_sspi/ (x86 for 32 bit and x64 for 64 bit apache)
Copy the mod_authnz_sspi.so from
Apache24\modules
folder and place it in the modules folder of your Apache folder on your webserverUnder the httpd.conf file (Config file for your apache) place this line of code. Try to load this as the last module:
LoadModule authnz_sspi_module modules/mod_authnz_sspi.so
Make sure that the following modules are uncommented
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authz_core_module modules/mod_authz_core.so
PS: both the above modules are required for this to work.
Place the following code in your httpd.conf file
<Directory "path/to/your/htcdocs/folder"> Options None AllowOverride All Order allow,deny Allow from all #AuthName "SSPI Protected Place" AuthType SSPI SSPIAuth On SSPIAuthoritative On SSPIOfferBasic On SSPIOmitDomain On Require valid-user </Directory>
Restart your apache servive and hopefully it should restart without any issues.
- Now in order to recognise the user , use the following code on a php page
echo $_SERVER['PHP_AUTH_USER'];
That's all.
I'm using:
- XAMPP Control Panel 3.2.1
- APACHE 2.4
这篇关于阿帕奇 - 如何获取REMOTE_USER变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!