Link to home
Start Free TrialLog in
Avatar of ricbax
ricbax

asked on

Apache 1.3.27 on WinXP - no HTTP authentication dialog box

Ok I am pretty sure I have done everything right. I know that I should be using Apache on a UNIX or Linux box, but this is for learning purposes.

I have read quite a few response on here and none have solved my problem.

I have placed the following in my httpd.conf and opted against an .htaccess file

<Directory "C:/Program Files/Apache Group/Apache/htdocs/phpmyadmin/">
    AuthUserFile "C:/Program Files/Apache Group/Apache/pswds/.htpass"    
    AuthType Basic
    AuthName "Database Config - Restricted Access"
    require valid-user  
</Directory>

this returns:

401 - Authorization Required
This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.


--------------------------------------------------------------------------------

Apache/1.3.27 Server at localhost Port 80


The problem is that the dialog box that should come up doesn't. What am i doing wrong?

ASKER CERTIFIED SOLUTION
Avatar of samri
samri
Flag of Malaysia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of zshipley
zshipley

I ran into this problem myself.
The solution is to not use paths that include spaces in them.  A space in Apache is like a break.
You have two options:
1) Relocate your .htpasswd file to a folder that does not have any spaces in its name
2) I believe that the folder "Program Files" can be referred to as "Progra~1".  Try replacing "Program Files" with that.
The Directory Directive is based off of your Document Root.  If your Docuemnt Root is C:/Program Files/Apache Group/Apache/htdocs then you should set your Directory Directive as follows.

<Directory /phpmyadmin>
   AuthUserFile "C:/Program Files/Apache Group/Apache/pswds/.htpass"    
   AuthType Basic
   AuthName "Database Config - Restricted Access"
   require valid-user  
</Directory>

That should work provided you have created the password file as mentioned above.

--Goodatunix
Hi!

goodatunix:
Directory directive is based on the physical path on disc, just as it sounds.

Location directive on the other hand is based from document root, and I think it even works on aliases.

I agree with samri spaces are bad.
And you need both a .htaccess and a .htpasswd

You should have a file in bin dir of apache install.
I'm not sure in windows though.
You use this exe to create the password.

Regards
/Hans - Erik Skyttberg
Ricbax,

Please try the modification I sent.  I've tested it on my own box and it works.

--goodatunix
Avatar of ricbax

ASKER

The points are going to samri, his answer triggered the answer I was looking for with the line: $cfg['PmaAbsoluteUri'] = 'http://yourserver/phpmyadmin/';
in the config.php.inc file of phpmyadmin.

I realized that if you use http://localhost/phpmyadmin/ the dialog box will not pop-up because you are within your own local intranet. However if you type in http://127.0.0.1/phpmyadmin/ that domain is recognized as an internet domain and then forces the dialog to pop-up.

I was still able to use only the httpd.conf file and .htpass file. No .htaccess file was necessary.

Thank you to everyone else that tried to solve my problem.