PHP Authentication on Apache

From: Date: Mon, 03 Sep 2001 20:30:14 +0000
Subject: PHP Authentication on Apache
Groups: php.general 
Request: Send a blank email to php-general+get-65797@lists.php.net to get a copy of this message
Hi all, Trying PHP for the first time. Snached the authentication code from the docs and put it in phpauth.php. When I surf to it, it just asks for my user and password again and again If I hit Cancel, it prints the little message just fine. Here's the code in case I'm the only one to RTFM: ------- Example 17-1. HTTP Authentication example <?php if(!isset($PHP_AUTH_USER)) { header("WWW-Authenticate: Basic realm=\"My Realm\""); header("HTTP/1.0 401 Unauthorized"); echo "Text to send if user hits Cancel button\n"; exit; } else { echo "<p>Hello $PHP_AUTH_USER.</p>"; echo "<p>You entered $PHP_AUTH_PW as your password.</p>"; } ?> --------------------- I have php 4.0.6 installed as a module(DSO) in apache 1.3.20 and everything else I've tried seems to work. Any Ideas? Anybody know if this is supposed to work? Should I stick with AuthPG and forget PHP authentication? BTW I don't have AuthType set in .htaccess or httpd.conf. Lynn Getting old isn't hard, all you got to do is live long enough......or fast enough.

« previous php.general (#65797) next »