Edit report at https://bugs.php.net/bug.php?id=51983&edit=1

 ID:                 51983
 Comment by:         f...@php.net
 Reported by:        konstantin at symbi dot org
 Summary:            [fpm sapi] pm.status_path not working when
                     cgi.fix_pathinfo=1
 Status:             Assigned
 Type:               Bug
 Package:            FPM related
 Operating System:   Any
 PHP Version:        5.3SVN-2010-06-03 (snap)
 Assigned To:        fat
 Block user comment: N
 Private report:     N

 New Comment:

but let's analyse all this:

FastCGI defines a communication protocol above CGI 1.1 (which is defined in RFC 
3875).
So fastcgi client/servers should be RFC 3875 compliant


>From RFC 3875:
Usefull required request variables are:
- PATH_INFO
- PATH_TRANSLATED
- QUERY_STRING
- SCRIPT_NAME

And the variable which are NOT defined in the RFC:
- DOCUMENT_ROOT
- SCRIPT_FILENAME
- REQUEST_URI

Here is a comparison of common web server behaviour to see what values they 
send 
to FPM. See http://pastebin.com/tqFjUaiB

Conlusion:
Nginx and Lighttpd are fully RFC 3875 compliant and they add the following 
variables:
- SCRIPT_FILENAME
- DOCUMENT_ROOT
- REQUEST_URI
Note: nginx should set PATH_INFO event if it's null as describe in the RFC. But 
this breaks nothing. So we can forgive him.


mod_fastcgi is acting as nginx and lighttpd only with the following 
configuration:
<VirtualHost *:82>
  DocumentRoot /home/fat/web/docs/php
  FastCgiExternalServer /home/fat/web/docs/php -host 127.0.0.1:9000
</VirtualHost>

but in this case, all request are sent to FPM and this is NOT what common users 
want to do. 

In order to send only php request, users can use the following configuration:
<VirtualHost *:82>
  DocumentRoot /home/fat/web/docs/php
  <Location "/php-fpm">
    Options +ExecCGI
    Order Deny,Allow
    Deny from All
    Allow from ENV=REDIRECT_STATUS
  </Location>

  FastCgiExternalServer /php-fpm-handler -host 127.0.0.1:9000
  AddType application/x-httpd-php .php
  Action application/x-httpd-php /php-fpm
  ScriptAlias /php-fpm /php-fpm-handler
</VirtualHost>

In this case, mod_fastcgi is not RFC 3875 compliant:
- DOCUMENT_ROOT, REQUEST_URI and QUERY_STRING are set correctely
- SCRIPT_FILENAME, SCRIPT_NAME, PATH_INFO, PATH_TRANSLATED have just wrong 
values

mod_proxy_fcgi is also not RFC 3875 compliant:
- DOCUMENT_ROOT, REQUEST_URI and QUERY_STRING are set correctely
- SCRIPT_FILENAME, SCRIPT_NAME, PATH_INFO, PATH_TRANSLATED have just wrong 
values

SCRIPT_NAME is even empty when apache env var proxy-fcgi-pathinfo is set


Previous Comments:
------------------------------------------------------------------------
[2011-07-16 19:34:19] f...@php.net

Warning: the following comment is very long. Take time to read it and don't 
hesitate to ask me for details questions.
Notes: I've not been able to put it all in one comment (it's detected as spam). 
So I've split it into several comments.

I just review de patch and there is a problem.

It does not work with mod_fastcgi except when mod_fastcgi is configured as 
commented before:

DocumentRoot "/var/www"
FastCgiExternalServer /var/www -socket /tmp/php-fpm.sock
<Directory /var/www>
    Options FollowSymLinks +ExecCGI
    AllowOverride   All
    Order           Allow,Deny
    Allow           from all
</Directory>

Setting this make all requests to be forward to php-fpm and that is definitely 
NOT what common configurations aim to do.

More common mod_fastcgi configuration would be something like:

ScriptAlias /fcgi-bin/ /usr/local/apache2/fcgi-bin/
FastCGIExternalServer /usr/local/apache2/fcgi-bin/php-cgi -host 127.0.0.1:9000
AddHandler php-fastcgi .php
Action php-fastcgi /fcgi-bin/php-cgi

and in this case, the patch does not work.

------------------------------------------------------------------------
[2011-07-03 17:28:11] fel...@php.net

Ah okay, I was wondering if it already has been closed. Thanks.

------------------------------------------------------------------------
[2011-07-03 17:24:37] f...@php.net

I'm dequeuing FPM bugs. I've started with the simple ones. This one is on my 
todo 
list. I don't have an ETA right now.

++ Jerome

------------------------------------------------------------------------
[2011-07-03 14:33:23] fel...@php.net

What is the status of this?

------------------------------------------------------------------------
[2011-02-01 13:34:05] slim at inbox dot lv

after applying the patch php compiled with debug complain on every request:

Feb 01 14:26:38.214800 [WARNING] [pool www] child 16257 said into stderr: "[Tue 
Feb  1 14:26:38 2011]  Script:  '-'"
Feb 01 14:26:38.214846 [WARNING] [pool www] child 16257 said into stderr: 
"/var/tmp/portage/dev-lang/php-5.3.5-r100/work/sapis-build/fpm/sapi/fpm/fpm/fpm_main.c(1116)
 :  Freeing 0x08B95CBC (23 bytes), script=-"
Feb 01 14:26:38.214857 [WARNING] [pool www] child 16257 said into stderr: "=== 
Total 1 memory leaks detected ==="
Feb 01 14:26:40.535416 [WARNING] [pool www] child 16258 said into stderr: "[Tue 
Feb  1 14:26:40 2011]  Script:  '-'"
Feb 01 14:26:40.535466 [WARNING] [pool www] child 16258 said into stderr: 
"/var/tmp/portage/dev-lang/php-5.3.5-r100/work/sapis-build/fpm/sapi/fpm/fpm/fpm_main.c(1116)
 :  Freeing 0x08B95EA4 (23 bytes), script=-"
Feb 01 14:26:40.535477 [WARNING] [pool www] child 16258 said into stderr: "=== 
Total 1 memory leaks detected ==="

a line at fpm_main.c(1116) causing this is 
SG(request_info).request_uri = request_uri ? estrndup(request_uri, 
strcspn(request_uri, "?")) : NULL;

------------------------------------------------------------------------


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

    https://bugs.php.net/bug.php?id=51983


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

Reply via email to