php[tek] 2018 : Call for Speakers

Voting

Please answer this simple SPAM challenge: nine plus zero?
(Example: nine)

The Note You're Voting On

ian AT iyates DOT co DOR uk
13 years ago
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'];
?>

<< Back to user notes page

To Top