Sabtu, 12 Februari 2022

Solusi mengubah mpm ke mpm_worker

 I found the possible solution to resolve this on my ubuntu server, dont know whether you are running ubuntu as well on your side, but I feel that the steps that I have taken will be the same for almost all distros with change in 1 step where you need to install a new package and the command for that may change based on the distro that you are using.

so the first step is

$ sudo a2dismod php7.3 mpm_prefork

This will disable the prefork module but before that it will disable the php7.3 module to stop the dependency error from occurring.

Next, we enable the worker module

$ sudo a2enmod mpm_worker

Now, the output would suggest that you restart the apache web-server. So, we do the same

$ sudo systemctl restart apache2

Now, if you go to check your website homepage, it may either throw an error or may load a blank page.

So, how do we resolve that; I scoured multiple community forums and found a solution related to the same but it was for freebsd platform so tried the same on ubuntu with some tweaks required to be made on ubuntu side for the steps to work.

The Solution based on ubuntu OS :

First of all, we enable the proxy, proxy_fcgi and setenvif module followed with a php-fpm package installation corresponding to your php version

$ sudo a2enmod proxy
$ sudo a2enmod proxy_fcgi
$ sudo a2enmod setenvif
$ sudo apt-get install php7.3-fpm -y

the php7.3-fpm installation command is the one where you may need to check the installation steps based on the Distro you are using.

Once, php-fpm service is installed you need to make sure that it gets enabled and then start it, so for that

$ sudo a2enconf php7.3-fpm
$ sudo systemctl enable php7.3-fpm.service
$ sudo systemctl start php7.3-fpm.service

Once, the php-fpm service starts successfully, just restart apache service to make sure all the made changes take effect properly

$ sudo systemctl restart apache2

After these steps are taken, please check/refresh your website homepage and the error page or the blank page will change to the proper website page.

The End-Result; your website has shifted from using prefork module to worker module to handle requests.

Also, if you want to switch to event module instead of worker module; just enable event module in place of worker module in the second step; the one that you will take after disabling php7.3 and prefork module

replace

$ sudo a2enmod mpm_worker

with

$ sudo a2enmod mpm_event

rest all steps after that remain the same irrespective of enabling worker or event module.

These steps helped me switch from prefork module to worker module on my server so hoping it may help you as well as help others who stumble on this issue.

Share:

KEPALA SMAN 95


Kepala SMAN 95 Jakarta

Dewi Elvi, S.Pd, M.Si

Profil SMAN 95

Pelepasan 2020