How to enable the mpm_prefork on Ubuntu
Apache2 has support for prefork and worker modules. These are both Multi-Processing Modules (MPMs), but are quite different from each other. Prefork MPM uses multiple child processes with one thread each and each process handles one connection at a time and Worker MPM uses multiple child processes with many threads each. Each thread handles one connection at a time. The prefork requires considerably more RAM compared to worker, it is the safest module and should be employed when using non-thread-safe libraries.
- To check to see if the prefork module is loaded, you can run following command
apache2ctl -M | grep prefork
- If you see no output, prefork isn’t loaded. You’ll need to first unload the mpm_event module before you do load prefork module as they will conflict. To unload mpm_event, you can run following command
sudo a2dismod mpm_event
a2dismod – Command used to disable an apache2 module
- Restart Apache using following command to reflect the changes.
sudo systemctl restart apache2
- Now you can load mpm_prefork using following command
sudo a2enmod mpm_prefork
a2enmod – Command used to enable an apache2 module
- Once again, restart Apache to reflect the changes.
sudo systemctl restart apache2
That’s it 🙂