473,577 Members | 3,334 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Apache 2.0 and PHP_AUTH_USER

I'm trying to get PHP authentication (using the headers to request
authentication, and then checking $_SERVER[PHP_AUTH_USER] and
$_SERVER[PHP_AUTH_PW]) - however, no matter what I do, I can't seem to get
it to work. The login request box pops up fine, but when I enter the correct
details, it just pops back up again, and then again, before finally dumping
me at the authentication failed page. I've tried looking at phpinfo(), and
PHP_AUTH_USER and PHP_AUTH_PASSWD are definitely not being filled. Having
browsed google, I came up with two possible answers:

1. I'm already using basic HTTP authentication via apache, and so (for
security reasons) PHP doesn't get passed the user and password.
This isn't the case - authentication is definitely switched off, and
AuthType doesn't occur anywhere in my apache config. I've tried switching
authentication on, and this means that the REMOTE_USER field gets filled, as
expected, but has no effect on PHP_AUTH_USER (also as expected).

2. I'm using the CGI version of PHP, rather than the Apache module.
I don't think this is the case, but phpinfo() reports the PHP server API as
"Apache 2.0 Filter", rather than anything clearcut. Does this mean I'm using
the module or not?

For reference, I'm running:

Mandrake 9.1
Apache 2.0.47
PHP 4.3.1

Any suggestions would be gratefully appreciated - if you'd like the full
output of my phpinfo(), or the exact script I'm using (although I've tried a
number of PHP authentication test scripts without any difference in
results), then let me know. Finally, if it turns out I'm not using a PHP
module, how can I set apache up so that it does? (I've tried adding
LoadModule lines to my http2.conf, which doesn't make any difference).

Thanks.
Jul 17 '05 #1
2 6768
On Wed, 24 Sep 2003 23:23:55 +0100, "Andrew Brett" <us****@brettwe b.plus.com>
wrote:
I'm trying to get PHP authentication (using the headers to request
authentication , and then checking $_SERVER[PHP_AUTH_USER] and
$_SERVER[PHP_AUTH_PW]) - however, no matter what I do, I can't seem to get
it to work. The login request box pops up fine, but when I enter the correct
details, it just pops back up again, and then again, before finally dumping
me at the authentication failed page. I've tried looking at phpinfo(), and
PHP_AUTH_USE R and PHP_AUTH_PASSWD are definitely not being filled. Having
browsed google, I came up with two possible answers:

1. I'm already using basic HTTP authentication via apache, and so (for
security reasons) PHP doesn't get passed the user and password.
This isn't the case - authentication is definitely switched off, and
AuthType doesn't occur anywhere in my apache config. I've tried switching
authenticati on on, and this means that the REMOTE_USER field gets filled, as
expected, but has no effect on PHP_AUTH_USER (also as expected).

2. I'm using the CGI version of PHP, rather than the Apache module.
I don't think this is the case, but phpinfo() reports the PHP server API as
"Apache 2.0 Filter", rather than anything clearcut. Does this mean I'm using
the module or not?
You are using the module.
For reference, I'm running:

Mandrake 9.1
Apache 2.0.47
PHP 4.3.1

Any suggestions would be gratefully appreciated - if you'd like the full
output of my phpinfo(), or the exact script I'm using (although I've tried a
number of PHP authentication test scripts without any difference in
results), then let me know. Finally, if it turns out I'm not using a PHP
module, how can I set apache up so that it does? (I've tried adding
LoadModule lines to my http2.conf, which doesn't make any difference).


This appears relevant:

http://bugs.php.net/bug.php?id=2044 1

Are you in safe mode?

--
Andy Hassall (an**@andyh.co. uk) icq(5747695) (http://www.andyh.co.uk )
Space: disk usage analysis tool (http://www.andyhsoftwa re.co.uk/space)
Jul 17 '05 #2
Thanks for the suggestion. However, this report only covers cases where
basic HTTP authentication (using .htaccess) is switched on. I've made sure
it's switched off, but that makes no difference.

"Andy Hassall" <an**@andyh.co. uk> wrote in message
news:57******** *************** *********@4ax.c om...
On Wed, 24 Sep 2003 23:23:55 +0100, "Andrew Brett" <us****@brettwe b.plus.com> wrote:
I'm trying to get PHP authentication (using the headers to request
authentication , and then checking $_SERVER[PHP_AUTH_USER] and
$_SERVER[PHP_AUTH_PW]) - however, no matter what I do, I can't seem to getit to work. The login request box pops up fine, but when I enter the correctdetails, it just pops back up again, and then again, before finally dumpingme at the authentication failed page. I've tried looking at phpinfo(), andPHP_AUTH_USE R and PHP_AUTH_PASSWD are definitely not being filled. Having
browsed google, I came up with two possible answers:

1. I'm already using basic HTTP authentication via apache, and so (for
security reasons) PHP doesn't get passed the user and password.
This isn't the case - authentication is definitely switched off, and
AuthType doesn't occur anywhere in my apache config. I've tried switching
authenticati on on, and this means that the REMOTE_USER field gets filled, asexpected, but has no effect on PHP_AUTH_USER (also as expected).

2. I'm using the CGI version of PHP, rather than the Apache module.
I don't think this is the case, but phpinfo() reports the PHP server API as"Apache 2.0 Filter", rather than anything clearcut. Does this mean I'm usingthe module or not?


You are using the module.
For reference, I'm running:

Mandrake 9.1
Apache 2.0.47
PHP 4.3.1

Any suggestions would be gratefully appreciated - if you'd like the full
output of my phpinfo(), or the exact script I'm using (although I've tried anumber of PHP authentication test scripts without any difference in
results), then let me know. Finally, if it turns out I'm not using a PHP
module, how can I set apache up so that it does? (I've tried adding
LoadModule lines to my http2.conf, which doesn't make any difference).


This appears relevant:

http://bugs.php.net/bug.php?id=2044 1

Are you in safe mode?

--
Andy Hassall (an**@andyh.co. uk) icq(5747695) (http://www.andyh.co.uk )
Space: disk usage analysis tool (http://www.andyhsoftwa re.co.uk/space)

Jul 17 '05 #3

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

Similar topics

2
4357
by: Timo Steinbach | last post by:
Hi, I use basic authentication in Apache. I like to use the global variable $_SERVER. Unfortunately this variable is empty/no availabe. Same with PHP_AUTH_PW. AUTH_TYPE is working and states "Basic". Can somebody help me with this? Thanks Timo
1
2281
by: Muffinman | last post by:
Hi, I got a web site which kinda relies on the $_SERVER var. Now I got a free account at Lycos and apparently they do not have Apache or do not have it running as a module since this var is empty. All I want is to be able to see which user has logged in through the ..htaccess dialog. Is there any other way to find this out, even on other...
5
10876
by: BT3 | last post by:
(newbie) I have taken some code directly out of a book: <?php // if we are using IIS, we need to set $PHP_AUTH_USER and $PHP_AUTH_PW if (substr($SERVER_SOFTWARE, 0, 9) == 'Microsoft' && !isset($PHP_AUTH_USER) && !isset($PHP_AUTH_PW) && substr($HTTP_AUTHORIZATION, 0, 6) == 'Basic '
1
5791
by: jerrygarciuh | last post by:
Hello, I am finding that on a new server where I am developing $_SERVER and $_SERVER Do not show up in $_SERVER when I when they should be defined I test using print_r($_SERVER) or this
5
27975
by: Grant Collins | last post by:
Hi I am writing a web based application as part of a small project that I am undertaking using servlets beans and jsp. I already have one servlet - bean - jsp page working and I have written another servlet - bean - jsp but I am hitting an error from tomcat that I have no idea why it is failing. I am getting an...
3
2811
by: Bernard Higonnet | last post by:
I'm running Apache/2.0.52 (Unix) mod_perl/1.99_16 Perl/v5.8.5 PHP/5.0.1 under FreeBSD 4.11-RELEASE #0. I suddenly (sic) no longer have PHP_AUTH_USER, PHP_AUTH_PW, and AUTH_TYPE or REMOTE_USER or any such variables. They do not show up in phpinfo() nor do they work as expected programmatically. I used to have them a few weeks ago. I...
1
3900
by: rbragg | last post by:
In my db, I have the fields user and pass with one record. With the following code, I get a continuous dialog box display. If I put in a bogus user/pass OR the correct user or pass, the dialog box pops up again. <?php //assume user is not authenticated $auth = false; $user = $_SERVER;
2
4196
by: gsherp | last post by:
How do I unset PHP_AUTH_USER and PHP_AUTH_PW? I am trying to create a logout script and I am encountering a problem where when go to relogin, I am already logged in. In my logout script, I started a session, unset(session), and then destroy_session(). But, everytime I go back to the login link, It does not give me the window popup for the...
1
2206
by: yawnmoth | last post by:
I was trying to test the following PHP script and am having some difficulty: <?php if (empty($_SERVER) || empty($_SERVER)) { header('WWW-Authenticate: Basic realm="Admin Control Panel"'); header('HTTP/1.0 401 Unauthorized'); exit;
0
7846
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7777
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...
1
7870
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8145
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...
0
6519
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...
1
5664
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...
0
5341
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...
1
2292
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
0
1111
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...

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.