[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 147
  • Last Modified:

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
0
dwessell
Asked:
dwessell
  • 3
1 Solution
 
dwessellAuthor Commented:
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
0
 
dwessellAuthor Commented:
die(print_r($_SERVER['PHP_AUTH_USER']));

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

Mod's feel free to close..
0
 
Computer101Commented:
PAQed with points refunded (250)

Computer101
EE Admin
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now