Php – Apache 2.4 w/ PHP 7: PHP7.1-FPM and/or libapache2-mod-fastcgi

apache-2.4mod-phpPHPphp-fpmphp7

I am in the process of upgrading a web server from using the slower, resource-intensive mod_php, and all has been well, until I noticed that PHP 7.1 is running successfully using only the php7.1-fpm package (from ondrej/php repository), without libapache2-mod-fastcgi installed. This behavior persists after restarting the system (Ubuntu 16.04.1) as well.

It was previously my understanding that Apache required both packages to be installed for the php7.1-fpm to work. However, this is evidently incorrect. Should I install the package libapache2-mod-fastcgi as well? On this same note, should I consider installing apache2-mpm-worker instead of (or in addition to) the standard apache2 package?

I understand that this is more of a best practices question, but I am looking more for if I am preparing a recipe for disaster.

UPDATE: I haven't yet found any difference in performance, but I still feel that there might be a technical reason that many "tutorials" and such suggest the aforementioned packages all in pair, especially at high loads or high traffic instances…

Best Answer

Adding modules to Apache that you don't need will only serve to increase the attack vector and increase (slightly) the memory footprint.

Apache's proxy/balancer can speak the FCGI protocol.