Re: Authentication with CGI Version of PHP
| From: | Ken | Date: | Thu, 30 Nov 2000 21:12:16 +0000 |
| Subject: | Re: Authentication with CGI Version of PHP | ||
| References: | 1 | Groups: | php.db php.general |
| Request: | Send a blank email to php-general+get-28123@lists.php.net to get a copy of this message | ||
At 01:51 PM 11/30/00 -0700, Keith Spiller wrote:
>Everywhere I read, Authentication with PHP requires PHP to be installed as a module. Is there
>no alternative for CGI versions? Anyway to trigger a browser username/password window...?
Keith -
I've been battling with the restrictions of PHP as a CGI for a while now.
As far as this goes, here's what I've discovered, in brief:
It requires configuring Apache to do the authentication. Make, for example, an .htaccess file in
your secure folder, like:
AuthName "Security Realm"
AuthType Basic
AuthUserFile bin/users
require valid-user
Then create a users file in your Apache/bin folder (there's probably a much, much more sensible
place to put it, but somewhere under Apache probably makes sense). Use htpasswd to add entries to
it.
Then your PHP script can read $REMOTE_USER to get the userid of the successful user.
It's more limited and frustrating than just being able to do everything within your PHP script,
but it does seem to work.
Hope this helps!
- Ken
kenzo(at)free-music.com