How to enable the mpm_prefork on Ubuntu

If you found this post helpful, kindly share it and show your support :)

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 🙂


Mohammed Noufal

I'm Mohammed Noufal, working as Server Admin for the last 10 years.  In my day-to-day life, l had to face different problems related to Web-hosting. On my website, you can find solutions for different Web-hosting-related problems. Sometimes, I spent hours searching/googling to find a solution. This inspired me to start a website that gives solutions to different Webhosting problems. This website includes basic Linux and windows commands, and different control panels like cPanel, Plesk, DirectAdmin, Webmin & so on. You can find solutions and or suggestions for different Web-hosting related problems from here. Hence I would like to say Errorlogz is your server protector.  I will be glad if Logdetect can help any one of the Server admins to find a solution to his problem.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *