The Workshop:
Configuring PHP-FPM & Apache

By Joe Ferguson

Last month we covered PHP and Apache and demonstrated how to get started with our custom virtual host in Apache and execute PHP via the libapache2-mod-php (mod-php) library. This month we will replace our use of mod-php with the Fast CGI Process Manager (FPM). Instead of bundling a PHP worker process in Apache, we’ll use FPM as another running service that will execute PHP. The requests are normally handled by Apache but instead of using mod-php, we’ll configure our virtual hosts to pass requests into the FPM service which will execute our PHP code and return the response to the Apache web server. One of the biggest benefits of using FPM with Apache is the ability to serve multiple PHP versions via the web server, which is not possible when using mod-php. by Joe Ferguson

This article was originally published in the February 2022 issue of php[architect] magazine. To read the complete article please subscribe or purchase the complete issue.

Leave a comment

Use the form below to leave a comment: