阿帕奇 - 如何获取REMOTE_USER变量 [英] Apache - how to get REMOTE_USER variable

查看:927
本文介绍了阿帕奇 - 如何获取REMOTE_USER变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

previously我用IIS服务器PHP服务器。目前,它是Apache。

在IIS我可以访问到变量 $ _ SERVER ['REMOTE_USER'] 返回的用户名和域名(如域\\用户),但在安装XAMPP后,这个变量是不可用。

我应该怎么做才能得到这个变量爬不起来?

我的应用程序在本地网络上没有互联网连接。


解决方案

最后它得到的作品! :D


  1. 从这里 https://www.apachehaus.net/modules/mod_authnz_sspi/ (X86 32位和x64 64位阿帕奇)


  2. 复制从 Apache24 \\模块mod_authnz_sspi.so 文件夹,并将其放置在你的Apache文件夹的modules文件夹上你的服务器


  3. 在httpd.conf文件(你的Apache的配置文件)放置此行code的。尝试加载这个作为最后一个模块:

    的LoadModule authnz_sspi_module模块/ mod_authnz_sspi.so


  4. 请确保以下模块都注释掉

    的LoadModule authn_core_module模块/ mod_authn_core.so

    的LoadModule authz_core_module模块/ mod_authz_core.so

    PS:上述两个模块都需要这个工作。


  5. 将以下code在httpd.conf文件


     <目录路径/要/你/ htcdocs /文件夹>
    选择无
    所有的AllowOverride
    为了允许,拒绝
    所有允许
    #AuthNameSSPI保护的地方
    AuthType选项SSPI
    SSPIAuth在
    SSPIAuthoritative在
    SSPIOfferBasic在
    SSPIOmitDomain在
    需要有效的用户
    < /目录>



  6. 重新启动你的apache servive,并希望它应该没有任何问题的重新启动。


  7. 现在,为了识别用户,请使用以下code PHP页面上

      

    回声$ _ SERVER ['PHP_AUTH_USER'];


  8.   

  这就是全部。


我使用的是:


  • 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

  1. Download the module from here https://www.apachehaus.net/modules/mod_authnz_sspi/ (x86 for 32 bit and x64 for 64 bit apache)

  2. Copy the mod_authnz_sspi.so from Apache24\modules folder and place it in the modules folder of your Apache folder on your webserver

  3. Under 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

  4. 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.

  5. 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>
    

  6. Restart your apache servive and hopefully it should restart without any issues.

  7. 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆