The Wayback Machine - https://web.archive.org/web/20120327033316/http://danielhe.com:80/2012/03/issues-with-apache-2-4-and-php-fpm/

Issues with Apache 2.4 and PHP-FPM

Currently I’m facing some issues getting PHP-FPM/FastCGI functioning properly with Apache 2.4.

mod_fastcgi no longer compiles properly, resulting in numerous errors such as the following;
mod_fastcgi.c:1413: error: request for member ‘log’ in something not a structure or union
mod_fastcgi.c:1413: error: request for member ‘connection’ in something not a structure or union
mod_fastcgi.c:1413: error: request for member ‘server’ in something not a structure or union

There are alternative PHP-FPM solutions using ProxyPass, however there are issues with static files and mod_rewrite breaks URL variable passing. Despite the issues, these two methods do actually get PHP-FPM to function.

mod_proxy
ProxyPass / fcgi://127.0.0.1:9000/www/
ProxyErrorOverride on

mod_rewrite:RewriteEngine On
RewriteRule ^/?(.*\.php)$ fcgi://127.0.0.1:9000/www/$1 [P,L]

There is an alternative to mod_fastcgi named mod_fastcgi_handler which compiles properly, but does not seem to properly connect to PHP-FPM. No errors turn up in PHP-FPM, but this does show up in Apache’s error_log.
(104)Connection reset by peer: [client x:63661] FastCGI: failed to write to backend server (id=4)

I will update this post as a solution is found.

*UPDATE MARCH 4*
Found a simple fix, adjust the ending URL for each VirtualHost and PHP-FPM works great. :)
ProxyPassMatch ^(.*\.php)$ fcgi://127.0.0.1:9000/www$1

*UPDATE MARCH 5*
Apparently ProxyPassMatch does not work very well inside virtualhosts, giving 404 errors for the same request URL.
(Apache 2.4.x bug?) A user on Apache’s mailing list gave me a suggestion to try using LocationMatch, and it worked great, so here it is.
<LocationMatch ^(.*\.php)$>
ProxyPass fcgi://127.0.0.1:9000/www
</LocationMatch>

*UPDATE MARCH 10*
If you prefer to use the old method of using mod_fastcgi, a user on has GitHub modified it to compile properly on Apache 2.4. (Link)



Drop Off Your 2 Cents