php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #2759 Apache send "Content-Type" before PHP (cgi-version) can send it's own headers.
Submitted: 1999-11-18 20:07 UTC Modified: 1999-11-21 21:18 UTC
From: joel dot jacobson at mobigym dot se Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0 Beta 3 OS: GNU/Linux v2.2.13
Private report: No CVE-ID: None
 [1999-11-18 20:07 UTC] joel dot jacobson at mobigym dot se
I have installed the cgi-bin version of PHP4 on my system.
I'm using Apache-SSL 1.3.9 with SuEXEC enabled.

php-scripts that contains HTTP-headers, like this one, won't work because Apache sends "Content-Type: text/html" before PHP can send it's HTTP-headers. For an example, this script doesn't work on my system:
<?php
if (!$PHP_AUTH_USER) {
header("HTTP/1.1 401 Access Denied");
header("WWW-Authenticate: Basic realm='Admin Login'");
header("Connection: close");
exit;
}
?>

I don't know if there is a way to solve this problem, is it?
It's probably not a bug, but maybe the PHP developers could write something about this in the FAQs.

Thanks for any comments.

Best regards, Joel Jacobson

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-11-21 21:18 UTC] sas at cvs dot php dot net
Replace

header("HTTP/1.1 401 Access Denied");

with

header("Status: 401 Access Denied");

and it should work.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 20:01:29 2024 UTC