[PHP-DB] Re: [PHP] Authentication with CGI Version of PHP From: Ken (kenzo <email protected>)
Date: 11/30/00

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

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe <email protected>
For additional commands, e-mail: php-db-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>