-
HTTP Auth woes
Hi,
I've installed PHPWiki and my authentication doesn't work.
It simply rejects my correct username/password.
Here's the auth code. It seems fine to me.
Code:
// Set these to your preferences.
// For heaven's sake pick a good password!
$wikiadmin = "myuser";
$adminpasswd = "mypass";
// Do not tolerate sloppy systems administration
if (empty($wikiadmin) || empty($adminpasswd)) {
echo gettext("Set the administrator account and password first.\n");
exit;
}
// From the manual, Chapter 16
if (($_SERVER['PHP_AUTH_USER'] != $wikiadmin ) ||
($_SERVER['PHP_AUTH_PW'] != $adminpasswd)) {
Header("HTTP/1.0 401 Unauthorized");
Header("WWW-Authenticate: Basic realm=\"PhpWiki\"");
echo gettext("You entered an invalid login or password."
exit;
}
-
Re: HTTP Auth woes
What server is it hosted on, because IIS doesn't like HTT Auth from PHP. If it is IIS then it can be configured to allow this. Gimmie a sec and I'll dig out the link.
-
Re: HTTP Auth woes
Thanks for your help.
I'm on:
Apache 1.3.34 (Unix): PHP v4.4.1 (suExec enabled)
MySQL v4.0.25-standard.
It's not my server. I'm paying for some server space.
The php script was in fact provided by my ISP. It installs automatically (i provide a couple of basic settings and the rest is automated.)
I'll ask my ISP if all else fails.
Thanks
-
Re: HTTP Auth woes
Your code seem valid, and nothings wrong with it. Have you tried printing out the values $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW'] when it failed to see if the information was sent correctly or at all?
-
Re: HTTP Auth woes
Yeah, they seem to be blank. So the message isn't getting through.
Any ideas?
I've tried firefox and IE by the way. same problem.
-
Re: HTTP Auth woes
Hmm try contacting your host because as far as i can tell it appear to be a problem with your host. They might be able to shed some more light on the situtation.
-
Re: HTTP Auth woes
Ok will do.
Thanks very much for your help.
-
Re: HTTP Auth woes
No worries, Can you please mark the thread as resolved :wave:
-
Re: HTTP Auth woes
If php's set up as a cgi, then the apache authentication hooks don't work.
You'd need to speak to your host to investigate that / to change it