473,396 Members | 1,871 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

PHP_AUTH_* doesn't work on Apache?

I was trying to test the following PHP script and am having some
difficulty:

<?php
if (empty($_SERVER['PHP_AUTH_USER']) ||
empty($_SERVER['PHP_AUTH_PW']))
{
header('WWW-Authenticate: Basic realm="Admin Control Panel"');
header('HTTP/1.0 401 Unauthorized');
exit;
}

echo 'PHP_AUTH_USER:
'.htmlspecialchars($_SERVER['PHP_AUTH_USER']).'<br />';
echo 'PHP_AUTH_PW: '.htmlspecialchars($_SERVER['PHP_AUTH_PW']);
?>

When I try it on Abyss web server what happens is that I enter "test"
as my username / password and then it echoes them back to me. On
Apache, it just keeps prompting me for the password. It's as though
PHP_AUTH_* is never being set. Any ideas as to why this is and what
I'd need to do to fix it?

Nov 5 '07 #1
1 2198
yawnmoth wrote:
I was trying to test the following PHP script and am having some
difficulty:

<?php
if (empty($_SERVER['PHP_AUTH_USER']) ||
empty($_SERVER['PHP_AUTH_PW']))
{
header('WWW-Authenticate: Basic realm="Admin Control Panel"');
header('HTTP/1.0 401 Unauthorized');
exit;
}

echo 'PHP_AUTH_USER:
'.htmlspecialchars($_SERVER['PHP_AUTH_USER']).'<br />';
echo 'PHP_AUTH_PW: '.htmlspecialchars($_SERVER['PHP_AUTH_PW']);
?>

When I try it on Abyss web server what happens is that I enter "test"
as my username / password and then it echoes them back to me. On
Apache, it just keeps prompting me for the password. It's as though
PHP_AUTH_* is never being set. Any ideas as to why this is and what
I'd need to do to fix it?
I know, I know... personal plug = bad taste.... However, I have done
some work with basic auth through apache/php and did a quick write up:
http://koivi.com/php-http-auth/

--
Posted via a free Usenet account from http://www.teranews.com

Nov 6 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: stijn goris | last post by:
hi all, I have a file (mode 644) I want to change to mode 777. The code: if (file_exists($this->mailAliasFile)) { echo "file exists<br>"; if (chmod ($this->mailAliasFile, 0777)) echo...
14
by: OldGuy | last post by:
Hi All Sendmail 8.12.11 php 4.3.9 Sendmail is installed and works properly. php is NOT in safemode from the command line; mail user@domain.com < testmsg works fine.
4
by: Eric West | last post by:
First, thanks for taking the time to read this message. I am trying to build a LAMP stack for the first time, and have encountered the following problem: CentOS 4.3 mysql 4.1.20 apache 2.2.3...
2
helimeef
by: helimeef | last post by:
Hi. I'm having issues trying to get .htaccess make mod_rewrite work. I have mod_rewrite setup properly (it's in phpinfo()), but it just seems to not work. Right now I have two files, bob.html and...
4
by: rosoft | last post by:
Hi Has anyone installed Apache on Windows XP and used it for .Net applications? If so how does it work. Lars
7
by: Joe | last post by:
I added some ajax to my asp.net web site and will Ajax just doesn't seem to work. Does Any one PLEASE have any ideas on why Ajax doesn't work on Apache 2.2.6 w/asp.net 2.0
1
by: valpal | last post by:
I'd like to post database query results on a HTML page. I use Activestate Perl and DBI; my SQL server is SQL 2005, which I can only log in to using my NT authentication. My problem is with...
8
blazedaces
by: blazedaces | last post by:
So I have a program below which writes an excel file with multiple sheets based on inputs of sheet names, data, cell types, etc. It uses Apache POI, which is currently the only thing I found...
6
by: josequinonesii | last post by:
I've searched, I've read, I've tested and re-read numerous post but to no avail yet... Quite simply, the settings I've applied to my httpd.conf, httpd-vhost.conf and my hosts files simply does not...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.