How to use httpauthentication locally I cannot log on when I test HTTP & nbsp; Authentication locally, but can log on when I put it in the purchased space. how can I use authentication locally? win & nbsp; 7. install apache & nbsp; 2.0 & nbsp; PHP & nbsp; 5.3 & nbsp; mysql & nbsp; 5.5. how to use http authentication locally
I cannot log on when I test HTTP Authentication locally, but can log on in the purchased space. how can I use authentication locally?
Win 7 in my system
Installed apache 2.0 PHP 5.3 mysql 5.5
In apache, httpd. conf also calls AUTH, for example
LoadModule auth_module modules/mod_auth.so
LoadModule auth_anon_module modules/mod_auth_anon.so
LoadModule auth_dbm_module modules/mod_auth_dbm.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule autoindex_module modules/mod_autoindex.so
$username = 'admin';
$password = 'admin';
if(isset($_SERVER['PHP_AUTH_USER']) &&
isset($_SERVER['PHP_AUTH_PW']))
{
if($_SERVER['PHP_AUTH_USER'] == $username &&
$_SERVER['PHP_AUTH_PW'] == $password)
echo "You are now logged in";
else die("Invalid username / password combination");
}
else
{
header('WWW-Authenticate: Basic realm = "Restricted Section"');
header('HTTP/1.0 401 Unauthorized');
die("Please enter your username and password");
}
Authentication module php header
------ Solution --------------------
For more information about apache, see. htaccess/. htpasswd.