$_SERVER['PHP_AUTH_USER'] is empty

前端 未结 2 1548
轮回少年
轮回少年 2020-12-19 06:30

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.

I am now working wi

相关标签:
2条回答
  • 2020-12-19 07:00

    Is safe mode activated? That might be your problem...

    As of PHP 4.3.0, in order to prevent someone from writing a script which reveals the password for a page that was authenticated through a traditional external mechanism, the PHP_AUTH variables will not be set if external authentication is enabled for that particular page and safe mode is enabled. Regardless, REMOTE_USER can be used to identify the externally-authenticated user. So, you can use $_SERVER['REMOTE_USER'].

    Source: http://php.net/manual/en/features.http-auth.php

    0 讨论(0)
  • 2020-12-19 07:03

    I finally found the answer thanks to 'mbinette'.

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

    Find here a post explaining a way to use CGI and PHP_AUTH, but i tried and it wasn't working.

    Find here some explanations about php handlers

    0 讨论(0)
提交回复
热议问题