How to switch apache mpm prefork to mpm event?

Hello as title says how i can switch mpm prefork to event? i tried follow some guides without success.

I’m trying change this because i’m using mpm event on my old server and i read performs it better than others (worker-prefork) with multiple concurrent connections and consume less resources.

We do not have any docs about switching to mpm event, maybe community can help?

@donko Can you write what all you tried ? What were the errors you faced ?
Switching to mpm_event is fairly straightforward, you do a2dismod phpxx and then do

a2dismod mpm_prefork 
a2enmod mpm_event

but please be warned, you cannot use mod_php based templates after this. HestiaCP does not support MPM_event out of the box

As I said before, better if you try this on a test server and just post if any problems so we can help

1 Like

I was doing in the wrong way.

Which you wrote worked perfectly.

1- a2dismod php7.3
2- a2dismod mpm_prefork
3- a2enmod mpm_event
and restart apache.

HestiaCP works normally and i can add and disable php versions except php7.3 from config tab.

A short question, I also want to change to MPM event. So any other valuable suggestion regarding this in addition to above. Does above works only when Apache is installed or I can use it when I have nginx + apache both installed.

with both i guess, i’m using nginx + apache.

1 Like

Yes I still don’t get it since 3 years ago. Why mpm prefork is still used in vestacp until this day. Even that 3years old thread in vestacp forum is not replied yet

Even in apache official docs they do not recommend it anymore.

https://cwiki.apache.org/confluence/display/HTTPD/PHP

Please remove support for mpm prefork in hestiacp. As its really old school.

1 Like

Thanks donko for update. I agree with maman. Any special advantages of mpm prefork over mpm event. If it is so easy to change why not make it default so that everyone has good resource usages.

I am using Ubuntu 20 and when I followed these steps to enable MPM_event, my website started giving 500 error ( Internal Server Error).
So, I had to disable ruid2 to fix the error.

a2dismod ruid2

I got this tip from this page : How to switch from Apache mpm_prefork to mpm_event on Debian/Ubuntu - TellUsTheAnswer

what says the error.log file?

i still do these steps on debian 10 and works (with recent installations)

Ubuntu 20.04 is currently not supported by hestia, how did you installed your system? :slight_smile:

On Debian 10, the above steps worked fine.
I was testing on Ubuntu 20 and got the 500 error.

On this page Testing Ubuntu 20.04, you have mentioned “Ok, we’ve got now a working installer for ubuntu 20.04”. So, I was testing on Ubuntu 20.

I ran the following commands to install on Ubuntu 20.

wget https://raw.githubusercontent.com/hestiacp/hestiacp/master/install/hst-install-ubuntu.sh
bash hst-install-ubuntu.sh

All good, wasnt clear that you are on a testing stack :).

What does the logs mean? It works when you disable mod_ruid2?

Yes, when I disabled mod_ruid2, the problem was gone and the website started opening.
So, it seems that mpm_event does not like mod_ruid2.