473,800 Members | 2,623 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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:
'.htmlspecialch ars($_SERVER['PHP_AUTH_USER']).'<br />';
echo 'PHP_AUTH_PW: '.htmlspecialch ars($_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 2215
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:
'.htmlspecialch ars($_SERVER['PHP_AUTH_USER']).'<br />';
echo 'PHP_AUTH_PW: '.htmlspecialch ars($_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
3156
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 "OK<br>"; else
14
22634
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
13725
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 php 5.1.6
2
6005
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 alice.html, and of course .htaccess (all in the root directory). What I want to happen is have bob.html show up when I visit alice.html, so I put this in .htaccess: RewriteEngine on RewriteRule ^alice\.html$ bob.html .htaccess does not seem to...
4
1641
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
2098
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
2169
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 establishing a connection. Typically I use something like: DBI->connect ("dbi:ODBC:driver=SQL Server;server=$server;database=$database") I don't specify the username or password because it defaults to the trusted connection. But if I do this using...
8
28384
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 (correct me if I'm wrong about this) that can write excel 2007 files. The program works. I've tested it out on very small files (I will include the commented out main method that you can use to test this out yourself if you'd like, that is assuming you...
6
7602
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 work. Please review my work and let me know if you see that one little thing that is throwing me for a loop. HTTPD.CONF # # This is the main Apache HTTP server configuration file. It contains the # configuration directives that give the...
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10507
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10279
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10036
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9092
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7582
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6815
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4150
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2948
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.