Link to home
Start Free TrialLog in
Avatar of dwessell
dwessell

asked on

HTTP authentication on Apache 1.3 with php

Hi,

I've just inherited a website, and I'm not sure on how some of the code functions..

It uses this bit:

if ( isset( $_SERVER['PHP_AUTH_USER'] ) ) {

And seems to auth off of a password file in the main dir, at least so far as I can tell from reading documentation..

I'm on a Fedora machine, running Apache 1.3.. It's also a Cpanel setup (With WHM)...

In /usr/local/apache/conf/sites I have a file called sitedomain.com.conf (Sub sitedomain for actual domain name)..

It contains information like:
 <Location "/askjohn">
                AuthName "Member Area"
                AuthType Basic
                AuthUserFile /home/domain/public_html/wfmpasswd
                Require valid-user
</Location>


Can someone clue me in on what else might be misssing? When I hit the pages that should auth, nothing happens..

Thanks
David
Avatar of dwessell
dwessell

ASKER

I added a htaccess file, and I can auth.. However, the variable $_SERVER['PHP_AUTH_USER'] always evaluates to false..

If I run a phpinfo, then I see that there are values there... Any suggestions?

Thanks
David
die(print_r($_SERVER['PHP_AUTH_USER']));

Always prints 1...
Figured it out, required a <Directory> directive in Apache's httpd.conf..

Mod's feel free to close..
ASKER CERTIFIED SOLUTION
Avatar of Computer101
Computer101
Flag of United States of America 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