|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45794 HTTP headers rendered differently in PHP than Apache rewrite mod likes them
Submitted: 2008-08-12 06:08 UTC Modified: 2008-08-13 03:21 UTC
From: tarag956 at gmail dot com Assigned:
Status: Not a bug Package: *Web Server problem
PHP Version: 5.2.6 OS: nix
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
34 + 43 = ?
Subscribe to this entry?

 [2008-08-12 06:08 UTC] tarag956 at gmail dot com
HTTP headers rendered differently in PHP than Apache rewrite mod likes them

For instance...

PHP renders a header this way (from the $_SERVER associated array):

But apache rewrite mod likes it:

I couldn't find any previous reports on this.  But basically, PHP needs some way for its HTTP headers to end up looking the same way that Apache's mod-rewrite likes them.

Other examples...
Apache likes them like:

But PHP usually converts all "-" to "_" and converts all ":" to "_" and sometimes adds "HTTP_" in front of things.

Maybe this is a feature request, but it would be nice if PHP's HTTP header variables could go be the exact names that HTTP's rewrite mod like them as.

Reproduce code:

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-08-12 13:32 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

HTTP headers and other variables follows the CGI specification:

 [2008-08-12 15:17 UTC] tarag956 at gmail dot com
Those links you gave were worthless and unrelated to the issue.

I've already read through the manual fully.

Are you claiming that somewhere hidden PHP actually can get the same exact style of headers ad mod-rewrite?  I have checked fully and there is no such thing.

Or are you claiming this is something PHP knows about and "won't fix"?

You never explicitly stated your reason for decaring the bug "bogus".
 [2008-08-12 15:20 UTC] tarag956 at gmail dot com
Also your first paragraph was an obvious form letter, and your second paragraph was unrelated so I'm no even sure if you understood what I initially said.

Also as for flagging bugs bogus, here's a screenshot unrelated to this bug report but related to falsely flagging bugs a bogus:
 [2008-08-12 15:21 UTC] tarag956 at gmail dot com
The form cut off the URL of the screenshot then made a link out of the decapitated URL.  It needs to be all on one line to be viewed.
 [2008-08-12 16:17 UTC]
> Or are you claiming this is something PHP knows about and "won't

Yes, this is known and expected. The X-Moz header or any header can be
retrieved by making it upper case and by replacing "-" by "_".

The advantage is that it allows only one representation of an header
(X-Moz, X-MOZ or x-moz will all be available with HTTP_X_MOZ).
 [2008-08-13 03:21 UTC] tarag956 at gmail dot com
So can you reclassify it as a feature request to view the actual raw headers how they were written that the browser sends in PHP?
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 17 01:01:29 2024 UTC