The fastest way to check your current Apache MPM (Multi-Processing Module) configuration is by running:
apache2ctl -V | grep -i mpm
# Or for httpd:
httpd -V | grep -i mpm
Example output for prefork:
Server MPM: prefork
For Linux systems using systemd:
systemctl status apache2 | grep -A 5 "Loaded"
Checking loaded modules:
apache2ctl -M | grep mpm_
Primary configuration files to inspect:
# For Debian/Ubuntu:
/etc/apache2/mods-available/mpm_prefork.conf
/etc/apache2/mods-available/mpm_worker.conf
# For CentOS/RHEL:
/etc/httpd/conf.modules.d/00-mpm.conf
Important consideration when switching MPMs:
# Prefork requires:
libapache2-mod-php
# Worker requires:
libapache2-mod-fcgid
php-fpm
Prefork example:
<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxRequestWorkers 150
MaxConnectionsPerChild 0
</IfModule>
Worker example:
<IfModule mpm_worker_module>
StartServers 3
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxRequestWorkers 150
MaxConnectionsPerChild 0
</IfModule>
If you get conflicting information:
# Verify all enabled modules:
apache2ctl -t -D DUMP_MODULES
# Check for multiple MPM modules loaded:
grep -r "LoadModule mpm_" /etc/apache2/
The simplest way to check Apache's Multi-Processing Module (MPM) is by running:
apache2ctl -V | grep -i mpm
or for older systems:
httpd -V | grep -i mpm
This will output something like:
Server MPM: prefork
or
Server MPM: worker
You can also inspect loaded modules:
apache2ctl -M | grep mpm
This shows which MPM module is currently active in the running Apache instance.
Apache's MPM is configured in these files depending on your OS:
- Debian/Ubuntu:
/etc/apache2/mods-available/mpm_*.conf
- CentOS/RHEL:
/etc/httpd/conf.modules.d/00-mpm.conf
To check which MPM is enabled:
ls /etc/apache2/mods-enabled/ | grep mpm
For prefork, you'll see multiple httpd processes with single threads:
ps aux | grep httpd
For worker, you'll see fewer parent processes with multiple threads each.
If you're running PHP as an Apache module, check its compatibility:
php -v | grep -i thread
Non-thread-safe (NTS) builds work with prefork, while thread-safe (TS) builds work with worker.
To change MPMs on Debian/Ubuntu:
sudo a2dismod mpm_prefork
sudo a2enmod mpm_worker
sudo systemctl restart apache2
Each MPM has distinct characteristics:
- Prefork: One process per request, more memory usage
- Worker: Threaded model, better for concurrent connections
Choose based on your server's resources and workload requirements.