note 40489 deleted from features.http-auth by cmb
| From: | cmb@php.net | Date: | Sun, 06 Oct 2019 08:32:00 +0000 |
| Subject: | note 40489 deleted from features.http-auth by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-212531@lists.php.net to get a copy of this message | ||
Note Submitter: ian AT iyates DOT co DOR uk
----
In my use of HTTP Authentication, I've found that some Apache setups swap around the usual
variables.
Here's the fix I made so that you can still use PHP_AUTH_USER and PHP_AUTH_PW. Hope it helps
someone
<?php
## Apache server fix ##
if (isset($_SERVER['PHP_AUTH_USER']) && !isset($_ENV['REMOTE_USER']))
$_ENV['REMOTE_USER'] = $_SERVER['PHP_AUTH_USER'];
if (isset($_SERVER['AUTH_PASSWORD']) && !isset($_ENV['PHP_AUTH_PW']))
$_ENV['PHP_AUTH_PW'] = $_SERVER['AUTH_PASSWORD'];
?>