Forum: NGINX PATH_INFO

Posted by Dave Dash (Guest)
on 2008-01-23 08:17
(Received via mailing list)
PATH_INFO is supposed to be decoded by the server and then passed to
the CGI application.

How can I do that from nginx.  My PATH_INFO never gets decoded and it
throws off my CGI scripts.

best,

dd
Posted by Aníbal Rojas (Guest)
on 2008-01-23 13:04
(Received via mailing list)
Dave,

    There is no support for CGI in Nginx. You have to FastCGI or HTTP 
(proxy)

--
Aníbal Rojas
http://hasmanydevelopers.com
http://rubycorner.com
http://anibal.rojas.com
Posted by Dave Dash (Guest)
on 2008-01-23 19:04
(Received via mailing list)
Yeah, I'm passing everything to FastCGI.

I'm using something similar to this:

location \.php(/|$) {
>
> fastcgi_param SCRIPT_FILENAME /path*/to/*$script_name;
> fastcgi_param PATH_INFO $path_info;
> }
>
>

but really $path_info should be url_decoded before being set as a
fastcgi_param.  Since the CGI spec says:

The extra path information, as given by the client. In other words, 
scripts
> can be accessed by their virtual pathname, followed by extra information at
> the end of this path. The extra information is sent as PATH_INFO. This
> information should be decoded by the server if it comes from a URL before it
> is passed to the CGI script.
>
>
But is there a way that I can just do

fstcgi_param PATH_INFO urldecode($path_info); ?


--
Posted by Cliff Wells (Guest)
on 2008-01-23 21:48
(Received via mailing list)
On Wed, 2008-01-23 at 09:56 -0800, Dave Dash wrote:
> but really $path_info should be url_decoded before being set as a
> fastcgi_param.  Since the CGI spec says:
> 
>         The extra path information, as given by the client. In other
>         words, scripts can be accessed by their virtual pathname,
>         followed by extra information at the end of this path. The
>         extra information is sent as PATH_INFO. This information
>         should be decoded by the server if it comes from a URL before
>         it is passed to the CGI script.

>From php.ini:

; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for 
CGI.  PHP's
; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and 
to not grok
; what PATH_INFO is.  For more information on PATH_INFO, see the cgi 
specs.  Setting
; this to 1 will cause PHP CGI to fix it's paths to conform to the spec. 
A setting
; of zero causes PHP to behave as before.  Default is 1.  You should fix 
your scripts
; to use SCRIPT_FILENAME rather than PATH_TRANSLATED.

Try setting

cgi.fix_pathinfo=0

in php.ini

Regards,
Cliff
Posted by Dave Dash (Guest)
on 2008-01-24 01:19
(Received via mailing list)
>
> Try setting
>
> cgi.fix_pathinfo=0
>
> in php.ini
>
> Regards,
>

Nope, that doesn't work either.  I instead opted to use a PHP script to
urldecode the data (using the prepend options in php.ini).  It works for
now, not ideal, but I get to use nginx.
Posted by Dave Dash (Guest)
on 2008-01-24 02:44
(Received via mailing list)
Anibal,

I am using a FastCGI server that nginx calls.  Right now (through
regexp) it takes the URL and figures out what part is the script
(blah.php) and what's the pathinfo (/q/string as in http://nginx/
blah.php/q/string).

But I need to decode the PATH_INFO before I pass it as a fast_Cgi
param.  is their a way to do that?

On Jan 24, 2008, at 7:25 AM, Aníbal Rojas wrote:

>
>>
>

Dave Dash
Eat smarter... www.reviewsby.us
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.