Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 08-05-2006, 06:31 PM   #1
Registered: May 2004
Location: Texas
Posts: 277

Rep: Reputation: 30
PHP and Apache Digest Authentication

I'm trying to generate an htaccess and htpasswd file using PHP. The result looks like this:

AuthName "Test3"
AuthType Digest
AuthDigestFile "/home/httpd/vhosts/mydomain/httpdocs/protected2/.htpasswd"
require valid-user
The username and password for the user in the .htpasswd are both "tester" and the password is encrypted with the PHP md5() function.

When I access the protected directory with Firefox 1.5 or Internet explorer, the same thing happens, I see the login box popup, but the server does not accept tester for the username and tester for the password. Is there something I am doing wrong here?

Thanks in advance.

Last edited by newuser455; 08-05-2006 at 06:32 PM.
Old 08-14-2006, 03:41 AM   #2
LQ Newbie
Registered: Jul 2005
Location: India
Posts: 23

Rep: Reputation: 15
digest authentication with squid

i have configured squid with digest authentication method:

auth_param digest program /usr/local/squid/libexec/digest_pw_auth /usr/local/squid/etc/digest_passwd
auth_param digest children 5
auth_param digest realm realm
auth_param digest nonce_garbage_interval 5 minutes
auth_param digest nonce_max_duration 30 minutes
auth_param digest nonce_max_count

users enter it's username/password, the server rejects information.

do i configure browser to use Digest authentication?

user's browser: Microsoft Internet Explorer 6

Thank You
Old 08-17-2006, 05:28 AM   #3
LQ Newbie
Registered: Jul 2005
Location: India
Posts: 23

Rep: Reputation: 15
Is there any help?????
Old 08-17-2006, 07:05 AM   #4
Registered: May 2004
Location: Texas
Posts: 277

Original Poster
Rep: Reputation: 30
The string that goes in htpasswd needs to look like

PHP Code:
$string $username ':' .$realm':'  md5($username':' .$realm':' $password); 


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
apache hangs when starting -> Digest: generating secret for digest authentication ... jma Linux - Networking 4 02-22-2007 01:02 AM
How to create mutual authentication between apache/php and tomcat nguyen_t_anh Linux - Security 0 05-14-2005 02:06 PM
php apache or php cgi - php learner rblampain Linux - Security 3 12-17-2004 11:10 PM
PHP Authentication jpbarto Programming 1 09-07-2004 10:11 AM
PHP and Username Authentication Graanco Linux - Software 0 07-31-2003 03:35 PM

All times are GMT -5. The time now is 03:49 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration