[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] [RAQ4] PHP_AUTH_USER



----- Original Message -----
From: "Jake Smith" <jake@xxxxxxxxxx>


>
> >What kind of errors?  What's printed to the error log?  Need a bit more
> >information.
>
> These are the errors that come up:
> Warning: Cannot add header information - headers already sent by (output
> started at /home/sites/site3/web/test.php:1) in
> /home/sites/site3/web/test.php on line 1
>
> Warning: Cannot add header information - headers already sent by (output
> started at /home/sites/site3/web/test.php:1) in
> /home/sites/site3/web/test.php on line 1
> Text to send if user hits Cancel button

Are you putting the auth code before anything else in the file?  IE:

<?php
// --- begin file auth.php ---
if(!isset($PHP_AUTH_USER)) {
         Header("WWW-Authenticate: Basic realm=\"My Realm\"");
         Header("HTTP/1.0 401 Unauthorized");
         echo "Text to send if user hits Cancel button\n";
         exit;
} else {
         echo "<p>Hello $PHP_AUTH_USER.</p>";
         echo "<p>You entered $PHP_AUTH_PW as your password.</p>";
}
?>

<!-- rest of doc, if any for some reason, goes below this line -->



<!-- end file auth.php -->

Then calling the file via http://www.yourdomain.com/auth.php ?

> >I'm assuming you do know that PHP has to be loaded as an Apache module
for
> >PHP_AUTH to work correctly.
>
> I thought php4  that ships with the raq4 is installed as a module?

I dunno.  I haven't seen a Raq4, but I'd assume it's compiled as a module.
Check httpd.conf for the LoadModule/AddModule lines relating to php.

--
Brian Curtis