Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

PATH_INFO and PATH_TRANSLATED

1,119 views
Skip to first unread message

hector

unread,
May 10, 2005, 12:39:19 PM5/10/05
to
I need examples of what these two environment variables, PATH_INFO and
PATH_TRANSLATED, would typically look like?

OReilly's CGI programming book guide says:

PATH_INFO

Extra path information passed to a CGI program.

PATH_TRANSLATED

The translated version of the path given by the variable PATH_INFO.

By example, what would be "extra path information?" and the translated
version of this?

Thanks


--
PLEASE NOTE: comp.infosystems.www.authoring.cgi is a
SELF-MODERATED newsgroup. aa.net and boutell.com are
NOT the originators of the articles and are NOT responsible
for their content.

HOW TO POST to comp.infosystems.www.authoring.cgi:
http://www.thinkspot.net/ciwac/howtopost.html

hector

unread,
May 10, 2005, 1:22:16 PM5/10/05
to
Sorry, I didn't look close enough. The OReilly bookguide had an example
specifically about "Extra Path Information."

This helps to clarify a few things but this is why I am asking.

The example shown:

http://some.machine/cgi-bin/display.pl/cgi/cgi_doc.txt

says that the PATH_INFO would be. e.g:

/cgi/cgi_doc.txt

and PATH_TRANSLATED would be the physical full path based on the document
root: e.g:

/usr/local/etc/httpd/public/cgi/cgi-doc.txt

I guess I am asking what would be the values for something like this:

http://some.machine/folder/test.php?p=data&p2=data

Which one would it be?

PATH_INFO = empty
PATH_INFO = /folder
PATH_INFO = /folder/test.php
PATH_INFO = /folder/test.php?p1=data&p2=data

PATH_TRANSLATED = empty
PATH_TRANSLATED = /usr/local/etc/httpd/folder
PATH_TRANSLATED = /usr/local/etc/httpd/folder/test.php
PATH_TRANSLATED = /usr/local/etc/httpd//folder/test.php?p1=data&p2=data

Note: I understand that some web servers will disable PATH_INFO,
PATH_TRANSLATED (clear them) for security reasons.

What I am trying to achieve is proper and consistent definition for a multi
server-side scripting engine web server that supports:

1) standard CGI applet spawning,
2) standard script mapping spawning such PHP, PERL, etc, and
3) our own WCX extension p-code compiled serve-side spawns.

For CGI, we use a specific URL alias, e.g.

/CGI/scriptfilename[?arguments]

For PHP, PERL, etc, we use a typical script mapping table. e.g.

/folder/scriptfilename.php[?argument]

For our WCX system it is built-in and based on the HTML page extension WCT:

/folder/htmlpage.wct[?arguments]

So I need to see what will be the PATH_INFO and PATH_TRANSLATED for each
case.

Thanks in advance for any insights you might be able to provide.

-- hector


"hector" <avs-track...@isdg.net> wrote in message
news:Ir5ge.7149$7A2....@bignews6.bellsouth.net...

Juha Laiho

unread,
May 11, 2005, 12:37:21 PM5/11/05
to
"hector" <avs-track...@isdg.net> said:
>Sorry, I didn't look close enough. The OReilly bookguide had an example
>specifically about "Extra Path Information."
>
>This helps to clarify a few things but this is why I am asking.
>
>The example shown:
>
> http://some.machine/cgi-bin/display.pl/cgi/cgi_doc.txt
>
>says that the PATH_INFO would be. e.g:
>
> /cgi/cgi_doc.txt
...

>I guess I am asking what would be the values for something like this:
>
> http://some.machine/folder/test.php?p=data&p2=data
>
>Which one would it be?
>
> PATH_INFO = empty

Empty, I'd say. The key is that your script is test.php, and the script
itself is the terminal element of the path. The rest (after the question
mark) are just query parameters - not part of the path.

In the earlier example, note that the script to be executed is display.pl,
and that path continues after the script name (so, there's a slash
character after the script name).
--
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)

hector

unread,
May 11, 2005, 2:03:02 PM5/11/05
to
> >I guess I am asking what would be the values for something like this:
> >
> > http://some.machine/folder/test.php?p=data&p2=data
> >
> >Which one would it be?
> >
> > PATH_INFO = empty
>
> Empty, I'd say. The key is that your script is test.php, and the script
> itself is the terminal element of the path. The rest (after the question
> mark) are just query parameters - not part of the path.
>
> In the earlier example, note that the script to be executed is display.pl,
> and that path continues after the script name (so, there's a slash
> character after the script name).

Thanks for your feedback.

The more I read up on this, the more it seems that isn't the answer.

This is where I am at with this so far:

In terms of a CGI, the URL for a PHP is effectively an alias for a /CGI-BIN
url:

/cgi-bin/php.exe/folder/test.php?arguments

Thus the PATH_INFO is:

PATH_INFO = /folder/test.php

and PATH_TRANSLATED is whereever that translated to:

PATH_TRANSLATED=/some_base_directory/folder/test.php

We are single sourcing a CGI spawn with the same source and the only
difference is where it is script mapped or not. The above logic is
consistent with OReilly's CGI Programming definition.

Does this make sense?

Thanks in advance

-- Hector

David Efflandt

unread,
May 13, 2005, 3:05:04 AM5/13/05
to

Yes. Sometimes PATH_INFO and PATH_TRANSLATED are used differently than
they are for CGI. For example with an ACTION directive used for a handler
of specified type, PATH_INFO is the requested URI path part of the URL and
PATH_TRANSLATED is the full system path of the requested resource. I have
never done PHP, but I imagine the handler that parses and interprets PHP
is like an ACTION handler.

But the best way to see what PATH_INFO and PATH_TRANSLATED contain is to
output them on different systems and see what they actually are.

0 new messages