httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Jagielski <...@jaguNET.com>
Subject Re: Summary: Broken FastCGI with httpd
Date Wed, 18 Jan 2017 21:00:31 GMT
The thing is that when we are proxying back, some of those
values can't make sense, since, for example, there is no
"real" path on the httpd server that maps to the actual
request file....

I think the original idea was to simply send the full URL to
the FCGI server, to let it parse things out for itself...
After all, it's easier for the FCGI server to know the SCRIPT_NAME
than httpd to "guess"... This was, iirc, the initial
concept related to how to leverage SCRIPT_FILENAME on
the PHP side.

What we need is some specific understanding between, in this
case, PHP-FPM and httpd on what it wants/expects/needs regarding
these env-vars. Yeah, SCRIPT_FILENAME seems core to this, I
think.

> On Jan 18, 2017, at 2:01 PM, Jacob Champion <champion.p@gmail.com> wrote:
> 
> On 01/18/2017 06:43 AM, Jim Jagielski wrote:
>> Also, the fact that different methods of invoking FCGI result
>> in different vars, at 1st blush, doesn't seem "incorrect"
>> assuming that each difference makes some sense, in a way.
> 
> They don't make sense. For example, mod_proxy_fcgi can be set up in a way that mirrors
the mod_fastcgi preferred configuration, using an Action:
> 
>  AddType application/x-php7-fpm .php
>  Action application/x-php7-fpm /php7-fpm virtual
>  <Location /php7-fpm>
>    SetHandler proxy:fcgi://localhost:9000
>  </Location>
> 
> This results in the following variables when I access the URL '/hello.php/path/info?query':
> 
>  SCRIPT_FILENAME: /var/www/php7-fpm
>  SCRIPT_NAME:     /php7-fpm
>  PATH_INFO:       /hello.php/path/info
>  PATH_TRANSLATED: /var/www/hello.php/path/info
>  QUERY_STRING:    query
> 
> We only get QUERY_STRING right. (Well, I won't say SCRIPT_FILENAME is "wrong", since
there is no standard definition, but it's not helpful.) SCRIPT_NAME is supposed to point to
a possible script-path (see RFC 3875 for definitions), '/hello.php' in this instance. PATH_INFO
and PATH_TRANSLATED should not include 'hello.php' in their values.

That is because we have no idea what SCRIPT_NAME is... With the "guess" that
it is /php7-fpm, then PATH_INFO kind of makes sense, since it is
the portion of the URI following the script. And considering
that we use

   Action application/x-php7-fpm /php7-fpm virtual

the 2nd parameter is specifically noted as *being the cgi-script* and
so of course httpd assumes that /php7-fpm is SCRIPT_NAME, because
we explicitly called it that :)


> 
> It's not just Action. PR 51517 contains examples using ProxyPassMatch.
> 
> --Jacob


Mime
View raw message