php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62172 FPM not working with Apache httpd 2.4 balancer/fcgi setup
Submitted: 2012-05-27 22:27 UTC Modified: 2013-05-24 13:32 UTC
Votes:19
Avg. Score:4.6 ± 0.8
Reproduced:16 of 17 (94.1%)
Same Version:4 (25.0%)
Same OS:5 (31.2%)
From: jdr at alexanderinteractive dot com Assigned: tony2001
Status: Closed Package: FPM related
PHP Version: 5.4.3 OS: CentOs 6
Private report: No CVE-ID:
 [2012-05-27 22:27 UTC] jdr at alexanderinteractive dot com
Description:
------------
See bug https://bugs.php.net/bug.php?id=54152 for a description of almost the exact same problem.
PHP now does recognize the proxy:fcgi Apache httpd 2.4 adds to the SCRIPT_FILENAME but it does not recognize proxy:balancer


Test script:
---------------
Example of working apache 2.4 config

RewriteRule ^/?(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/usr/local/home/magento/app/current/$1 [P,L]

Example of non-working apache 2.4 config

<Proxy balancer://magento/>
    BalancerMember fcgi://localhost:9000/
</Proxy>

# Serve PHP through php-fpm: 
RewriteRule ^/?(.*\.php(/.*)?)$ balancer://magento/usr/local/home/magento/app/current/$1 [P,L]

Expected result:
----------------
I expect the same results from both apache configurations

Actual result:
--------------
I get a 404 on all php pages when using balancer

Patches

fpm-balancer-v3 (last revision 2015-04-28 15:20 UTC) by matt at haught dot org)
fpm-balancer-v2 (last revision 2014-02-01 19:42 UTC) by matt at haught dot org)
fpm-balancer (last revision 2012-05-28 00:50 UTC) by jdr at alexanderinteractive dot com)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-05-28 01:09 UTC] jdr at alexanderinteractive dot com
I added a quick patch that just duplicates some of the committed proxy:fcgi code. It seemed to work for me.

Unfortunately there still seems to be at least 1 issue on the apache side.
When adding query strings to a php page, I get 404s. This works fine without the balancer set up.

It could be related to this bug https://issues.apache.org/bugzilla/show_bug.cgi?id=51077
 [2013-05-24 13:32 UTC] tony2001@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: tony2001
 [2014-02-01 19:50 UTC] matt at haught dot org
Adding copied "ignore query string if sent by Apache (RewriteRule)" bit of code in fpm-balancer-v2 patch fixes the query problems with apache-2.4.6 proxy balancer when using ProxyPassMatch. Without it a request for test.php works but test.php?q=1 fails with file not found.
 [2014-10-03 22:13 UTC] stefan at eriksson dot cn
Any news on this? Debian with Jessie coming out is depending on this to get load balancing of multiple php-fpm backends over tcp from one single apache instance.
 [2015-04-28 05:22 UTC] quan at quanphuong dot com
Just a note: fpm-balancer-v2 patchs worked well.
 [2015-04-28 15:28 UTC] matt at haught dot org
I added patch fpm-balancer-v3. The most recent version of apache24 appear to now remove the prefix. So the the removal of the query string needs to be moved out of the code that catches the prefixes otherwise it will not be applied. Older apache24 will work the same and the newer version will just have the query string cut off.

I put in a pull request that I will continue to keep up-to-date.
https://github.com/php/php-src/pull/1197
 [2016-01-05 22:00 UTC] shawn dot starr at rogers dot com
So, I've encountered this too using this setup:

<Proxy balancer://php-fpm>
  BalancerMember fcgi://127.0.0.1:9000
  BalancerMember fcgi://172.31.40.234:9000
</Proxy>

ProxyPassMatch ^/(.*\.php(/.*)?)$ balancer://php-fpm/some/path/to/stuff/$1

I get same File Not Found / Script Error in apache log.

Any word on when this is being merged into PHP 5.5 and or 7?
 [2016-01-29 09:23 UTC] remi@php.net
Automatic comment on behalf of remi
Revision: http://git.php.net/?p=php-src.git;a=commit;h=07d2dcdf09fcfbd617031bd341384efb236de12c
Log: Fixed Bug #62172 FPM not working with Apache httpd 2.4 balancer/fcgi setup
 [2016-01-29 09:23 UTC] remi@php.net
-Status: Assigned +Status: Closed
 [2016-01-29 09:25 UTC] remi@php.net
Automatic comment on behalf of remi
Revision: http://git.php.net/?p=php-src.git;a=commit;h=07d2dcdf09fcfbd617031bd341384efb236de12c
Log: Fixed Bug #62172 FPM not working with Apache httpd 2.4 balancer/fcgi setup
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Feb 26 21:01:35 2017 UTC