I have searched for an answer but cannot seem to find anything substantial related to this question.

Should one use mod_proxy_fcgi or mod_fastcgi with php-fpm on Apache2.4?

Are there any differences in terms of security and performance? Any recommendations?

Thanks in advance for any help.

up vote 7 down vote accepted

mod_proxy_fcgi, which is newly available in Apache 2.4, is just for this type of use case. The Apache wiki entry for PHP-FPM has some good guidance to get started.

The mod_proxy_fcgi documentation also includes specific examples for setting up PHP-FPM and the PHP documentation also has helpful information.

Note also (notwithstanding some erroneous references to the contrary), unix sockets are not available for this until Apache 2.4.10 (2.4.9 was not really released), so you can't use them under 2.4.7.

On the other hand, mod_fastcgi is notoriously difficult to set up and a memory hog. Additionally, mod_fcgi doesn’t support spawned CGI servers. Because PHP-FPM is managed by itself, not by Apache, mod_fcgi isn’t the best choice.

  • This explains why nothing was working when I attempted to set up mod_proxy_fcgi, I have Apache2.4.7 and a habit of using unix sockets. :) Any comments on performance? I know mod_fastcgi uses memory but is it faster? – Reuben Debattista Jun 10 '16 at 9:10
  • speed should not be an issue, although using sockets is probably more efficient; probably more important to be able to spawn PHP-FPM processes – Colt Jun 10 '16 at 9:24
  • So I will be sticking to mod_fastcgi because it seems the more logical choice. Thank you very much for your answer. – Reuben Debattista Jun 10 '16 at 9:28
  • Yeah I prefer using sockets for efficiency. – Reuben Debattista Jun 10 '16 at 9:29
  • I think the right answer is mod_proxy_fcgi - the spawning capability is important for efficiency – Colt Jun 10 '16 at 9:30

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.