Apache MPM Event with PHP-FPM on Debian 12

Apache by default comes with an old crusty style of doing things which includes MPM prefork and mod_php. I am going to instead use the threaded event multi-processing module.


apachectl -M | grep 'mpm'

root@www:~#  apachectl -M | grep 'mpm'
mpm_prefork_module (shared)


root@www:~# a2query -m |grep php
php8.2 (enabled by maintainer script)

a2dismod php8.2
a2dismod mpm_prefork
a2enmod mpm_event

apt install php-fpm

Creating config file /etc/php/8.2/fpm/php.ini with new version
NOTICE: Not enabling PHP 8.2 FPM by default.
NOTICE: To enable PHP 8.2 FPM in Apache2 do:
NOTICE: a2enmod proxy_fcgi setenvif
NOTICE: a2enconf php8.2-fpm
NOTICE: You are seeing this message because you have apache2 package installed.
Created symlink /etc/systemd/system/multi-user.target.wants/php8.2-fpm.service → /lib/systemd/system/php8.2-fpm.service.
Setting up php-fpm (2:8.2+93) ...
Processing triggers for man-db (2.11.2-2) ...
Processing triggers for php8.2-fpm (8.2.20-1~deb12u1) ...
NOTICE: Not enabling PHP 8.2 FPM by default.
NOTICE: To enable PHP 8.2 FPM in Apache2 do:
NOTICE: a2enmod proxy_fcgi setenvif
NOTICE: a2enconf php8.2-fpm
NOTICE: You are seeing this message because you have apache2 package installed.


apt install libapache2-mod-fcgid
Uses unix socket.
		
a2enconf php8.2-fpm		
a2enmod proxy
a2enmod proxy_fcgi

apachectl configtest
Syntax OK

systemctl restart apache2

apachectl -M | grep 'mpm'
mpm_event_module (shared)