How to enable PHP-FPM with Event MPM on Apache2


The Apache HTTP web server is very popular used by more than 30% of all the websites, working perfectly on basic tasks, fulfilling day to day needs. Usually default settings are good, but in some conditions the server can fail to provide stability, poorly serve content to users or perform badly on high traffic.

This tutorial demonstrates how to install Event MPM module and PHP-FPM on an Ubuntu web server. The MPM Event module is a fast multi-processing module that is part of Apache HTTP web server, we will be using it with FastCGI Process Manager(PHP-FPM) to boost Apache. The FastCGI protocol is based on the Common Gateway Interface (CGI), a protocol that sits between applications and web servers.


In order to be able to use this tutorial, you will need to have an access (SSH) to a server and have Apache web server or LAMP Stack installed.
In this tutorial PHP 7.4 version is used, if you need different version, just replace PHP package to appropriate version ("php7.4-fpm" to "php7.2-fpm").

  • Works on Ubuntu 16.04, 18.04, 20.04
  • Aplications: The Apache, PHP(7.4) or LAMP stack
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update

Add needed software repositories to Ubuntu

Step 1 – Installing required Apache modules & tools
sudo apt install php7.4-fpm

Installing of PHP-FPM

Testing PHP-FPM
sudo systemctl status php7.4-fpm

Checking if PHP-FPM is working correctly and running as a daemon

Status of PHP-FPM service
Status of PHP-FPM service
Step 2 – Set up of modules
sudo a2enmod actions alias proxy_fcgi setenvif
sudo systemctl restart apache2
sudo a2enmod proxy_fcgi setenvif
sudo a2enconf php7.4-fpm
sudo a2dismod php7.4 mpm_prefork
sudo a2enmod mpm_event
sudo systemctl restart apache2

Those commands will enable MPM Event module and all required extensions.

Testing Apache Event module
sudo apachectl -V | grep MPM
Status of Apache MPM Event module
Status of Apache MPM Event module


And you're done! Congratulations! PHP processing is now handled by PHP-FPM and Apache MPM Event module is enabled.


Apache2, PHP-FPM, MPM Event
Apache2 with PHP-FPM