469,282 Members | 2,034 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,282 developers. It's quick & easy.

PATH_INFO vs. ORIG_PATH_INFO

Does anyone know what the deal is on ORIG_PATH_INFO vs. PATH_INFO?
I use the "real" path_info from the server
(e.g. in http://webcomp.org/index.php/something/else,
the path_info is /something/else) that used to be found in
$_SERVER["PATH_INFO"]

However, under Apache 1.3.37 with a System:
Linux host45.hostmonster.com 2.6.17-11_4.BHsmp #1 SMP Fri Nov 17
17:14:51 MST 2006 x86_64
and PHP 5.1.6. CGI (on http://hostmonster.com)
regardless of the setting of cgi.fix_pathinfo, whether 0 or 1.

On the other hand, $_SERVER['ORIG_PATH_INFO'] returns the correct
information in the above setup.

So is the PHP version/Server independent way of doing this supposed to
be something like:
$path_info = @$_SERVER['ORIG_PATH_INFO'];
if (!$path_info) $path_info = @$_SERVER['PATH_INFO'];

Csaba Gabor from Vienna
See also http://bugs.php.net/bug.php?id=31892
Searching for ORIG_PATH_INFO on php.net's online documentation turned
up nothing.
Some references: http://hoohoo.ncsa.uiuc.edu/cgi/env.html
http://at.php.net/manual/en/ref.apache.php
http://nl2.php.net/reserved.variables

Finally, as an aside, note that you can do function lookups in on
php.net by writing something like the very pretty:
http://php.net/pathinfo
It is tempting to say that this is an example of PATH_INFO at work
(with an implied index.php), but it is not. For PATH_INFO to work, the
explicit URL, including the file, must be provided (e.g.
http://php.net/index.php/pathinfo which leads to the main php page).
To get apache to behave as you would expect it to behave, you have to
do URL rewriting within apache. Too bad.

Jan 9 '07 #1
0 3449

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Preston Crawford | last post: by
1 post views Thread by divya | last post: by
4 posts views Thread by Chuck Anderson | last post: by
reply views Thread by fmcarol | last post: by
2 posts views Thread by undbund | last post: by
12 posts views Thread by Michael Windsor | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.