Req #54152 [PATCH]: Make FPM compatible with Apache HTTP Server 2.3 mod_proxy_fcgi

2011-03-07 Thread jim...@php.net
Edit report at http://bugs.php.net/bug.php?id=54152&edit=1

 ID: 54152
 Patch added by:     [email protected]
 Reported by:mark at catseye dot org
 Summary:Make FPM compatible with Apache HTTP Server 2.3
 mod_proxy_fcgi
 Status: Assigned
 Type:   Feature/Change Request
 Package:FPM related
 Operating System:   Linux
 PHP Version:5.3SVN-2011-03-03 (snap)
 Assigned To:jimjag
 Block user comment: N
 Private report: N

 New Comment:

The following patch has been added/updated:

Patch Name: mod_proxy_fcgi-support-v3.patch
Revision:   1299523794
URL:   
http://bugs.php.net/patch-display.php?bug=54152&patch=mod_proxy_fcgi-support-v3.patch&revision=1299523794


Previous Comments:

[2011-03-07 18:40:55] mark at catseye dot org

jimjag, I've attached version 2 of the patch (
mod_proxy_fcgi-support-v2.patch ) which changes only the FPM/FastCGI
code path and leaves the CGI code path unmodified.



Thanks for your time on this!


[2011-03-07 17:24:01] [email protected]

My preference would be to simply add this to the fpm/FastCGI code path,
since this 

is solely due to how Apache handles that protocol. Also folding into the
cgi path 

unnecessary muddies things, imo.


[2011-03-04 23:55:01] mark at catseye dot org

The problem on the Apache HTTP Server end between mod_proxy_fcgi and
php-fpm has been addressed, and the solution will be in the second beta
of Apache HTTP Server 2.4, which will be version 2.3.12 (the first beta,
2.3.11, will be released Monday March 7th).



https://issues.apache.org/bugzilla/show_bug.cgi?id=50851


[2011-03-03 20:35:44] mark at catseye dot org

The second URL is incorrect; apologies for the mistake.  The correct URL
for the problem that is being addressed on the Apache end is:



https://issues.apache.org/bugzilla/show_bug.cgi?id=50851


[2011-03-03 19:54:29] mark at catseye dot org

Description:

Apache HTTP Server 2.3 is about to enter beta in preparation for a

general availability release of 2.4 soon, see:



http://marc.info/?l=apache-httpd-dev&m=129900037316343&w=2



Apache HTTP Server 2.3 comes with mod_proxy_fcgi as a standard module;

mod_fcgid and mod_fastcgi are not standard modules.  Unfortunately,

mod_proxy_fcgi and php-fpm do not work with each other.  One problem

is already being addressed on the Apache end:

http://marc.info/?l=apache-httpd-dev&m=129900037316343&w=2



There are two problems that, in my opinion, are best addressed

on the PHP end of things (patch attached).  php-fpm will then

work out of the box with mod_proxy_fcgi:



Problem 1:



PHP relies on the SCRIPT_FILENAME environment variable to find the
script

to execute in the filesystem.  (It can also use SCRIPT_NAME for this,
but

that will fail if the document root for php-fpm does not match the
document

root of the httpd proxy).  In Apache HTTP Server 2.3, all proxy modules

prefix SCRIPT_FILENAME with "proxy:" followed by a protocol name, for

example, when the user requests



https://server-name/test/test.php



Apache HTTP Server sets SCRIPT_FILENAME to



proxy:fcgi://127.0.0.1:9000/www/php-ssl/test.php/extra/stuff



The attached patch causes php-fpm to recognize the "proxy:"

convention in this case, and skip over the subsequent protocol,

hostname and port.  In this example, SCRIPT_FILENAME then becomes



/www/php-ssl/test.php/extra/stuff



...which php-fpm is able to deal with correctly.



I believe that PHP is the correct place to change this, rather than in

Apache HTTP Server, since the proxy (httpd) and origin (php-fpm, in
this

case) may be on different servers machine and httpd should not make

assumptions about the origin's document root or URI path namespace
mapping.





Problem 2:



Apache HTTP Server is not able to set a value for PATH_INFO and still

comply with RFC 3875, for the reasons in the last paragraph above.



sapi/fpm/fpm/fpm_main.c:init_request_info() will find the base script

using SCRIPT_FILENAME, but uses this to calculate and offset into the

original PATH_INFO environment variable.  Since no such environment

variable exists (if the patch to Apache HTTP Server is applied),





Additional notes:



Except for 21 additional lines in the fpm version, the code in

init_request_info() is duplicated in the following two files

(378 identical lines in the two versions of this one function):



sapi/fpm/fpm/fpm_main.c

sapi/cgi/cgi_main.c



The changes in the attached patch are made to both files.  While

they are

Req #54152 [Com]: Make FPM compatible with Apache HTTP Server 2.3 mod_proxy_fcgi

2011-03-07 Thread jim...@php.net
Edit report at http://bugs.php.net/bug.php?id=54152&edit=1

 ID: 54152
 Comment by:     [email protected]
 Reported by:mark at catseye dot org
 Summary:Make FPM compatible with Apache HTTP Server 2.3
 mod_proxy_fcgi
 Status: Assigned
 Type:   Feature/Change Request
 Package:FPM related
 Operating System:   Linux
 PHP Version:5.3SVN-2011-03-03 (snap)
 Assigned To:jimjag
 Block user comment: N
 Private report: N

 New Comment:

please try v3 of the patch... This limits the later on version of the
changes to 

just be in effect when we know we're handling the proxy:fcgi:// stuff


Previous Comments:

[2011-03-07 19:49:55] [email protected]

The following patch has been added/updated:

Patch Name: mod_proxy_fcgi-support-v3.patch
Revision:   1299523794
URL:   
http://bugs.php.net/patch-display.php?bug=54152&patch=mod_proxy_fcgi-support-v3.patch&revision=1299523794


[2011-03-07 18:40:55] mark at catseye dot org

jimjag, I've attached version 2 of the patch (
mod_proxy_fcgi-support-v2.patch ) which changes only the FPM/FastCGI
code path and leaves the CGI code path unmodified.



Thanks for your time on this!


[2011-03-07 17:24:01] [email protected]

My preference would be to simply add this to the fpm/FastCGI code path,
since this 

is solely due to how Apache handles that protocol. Also folding into the
cgi path 

unnecessary muddies things, imo.


[2011-03-04 23:55:01] mark at catseye dot org

The problem on the Apache HTTP Server end between mod_proxy_fcgi and
php-fpm has been addressed, and the solution will be in the second beta
of Apache HTTP Server 2.4, which will be version 2.3.12 (the first beta,
2.3.11, will be released Monday March 7th).



https://issues.apache.org/bugzilla/show_bug.cgi?id=50851


[2011-03-03 20:35:44] mark at catseye dot org

The second URL is incorrect; apologies for the mistake.  The correct URL
for the problem that is being addressed on the Apache end is:



https://issues.apache.org/bugzilla/show_bug.cgi?id=50851




The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

http://bugs.php.net/bug.php?id=54152


-- 
Edit this bug report at http://bugs.php.net/bug.php?id=54152&edit=1