Re: newbie question - apache-win2K-authentication
| From: | Richard Lynch | Date: | Fri, 03 Aug 2001 02:21:01 +0000 |
| Subject: | Re: newbie question - apache-win2K-authentication | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-61056@lists.php.net to get a copy of this message | ||
If you are not using ISAPI, you are using "CGI" -- and you are using Action
in your httpd.conf file.
The CGI version simply cannot do HTTP authentication from within PHP.
You'll have to do your HTTP authentication using .htaccess files.
--
WARNING richard@zend.com address is an endangered species -- Use
ceo@l-i-e.com
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
----- Original Message -----
From: Shari Fletcher <sfletcher@terrace.com>
Newsgroups: php.general
To: PHP List <php-general@lists.php.net>
Sent: Thursday, August 02, 2001 9:42 AM
Subject: newbie question - apache-win2K-authentication
> Hi all ---
>
> I'm having some trouble getting basic authentication working. Either that
> or my privileges are screwed up, or something.
>
> I am running Apache on Windows 2000 and PHP4. I've searched newsgroups,
> this mailing list, various FAQs and the manual, I think my eyes are
> crossing. I've got a feeling either its so simple I can't see it, or its
> not possible. I'm hoping someone has a quick idea about what's going on.
>
> Here's my story:
>
> My authentication script is from this example.
>
> If I leave it as is, I can authenticate and I receive the error:
>
> malformed = header from script. Bad header=3DHTTP/1.0 401 Unauthorized:
> =e:/php/php.exe
>
> If I change the unauthorized header to this: header("Status: 401
> Unauthorized"); I cannot authenticate, though the user id and password is
> correct.
>
>
> Thanks in advance !
> Shari
>
>
> My script:
>
> if (!isset($PHP_AUTH_USER)) {
>
> // If empty, send header causing dialog box to appear
> header('WWW-Authenticate: Basic realm="securedf"');
> header('HTTP/1.0 401 Unauthorized');
> echo 'Authorization Required.';
> exit;
> }
>
> // If not empty, display values for variables
>
> else {
>
> echo "
> <P>You have entered this username: $PHP_AUTH_USER<br>
> You have entered this password: $PHP_AUTH_PW<br>
> The authorization type is: $PHP_AUTH_TYPE</p>
> ";
> }
>