Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Apache MPM from prefork to worker

I need to change MPM prefork module to worker but it's not working on my Debian 9.1. When I enable worker module, PHP is not working. I can't enable php7.0 module back.

Here is the output from console:

root@Debian-91-stretch-64-LAMP ~ # apachectl -V | grep -i mpm

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 2a01:4f8:171:fc2::2. Set the 'ServerName' directive globally to suppress this message

Server MPM: prefork

root@Debian-91-stretch-64-LAMP ~ # a2enmod mpm_worker

Considering conflict mpm_event for mpm_worker: Considering conflict mpm_prefork for mpm_worker: ERROR: Module mpm_prefork is enabled - cannot proceed due to conflicts. It needs to be disabled first!

root@Debian-91-stretch-64-LAMP ~ # a2dismod mpm_prefork

ERROR: The following modules depend on mpm_prefork and need to be disabled first: php7.0 root@Debian-91-stretch-64-LAMP ~ # a2dismod php7.0 Module php7.0 disabled.

To activate the new configuration, you need to run:

systemctl restart apache2

root@Debian-91-stretch-64-LAMP ~ # a2dismod php7.0

Module php7.0 disabled.

To activate the new configuration, you need to run:

systemctl restart apache2

root@Debian-91-stretch-64-LAMP ~ # a2enmod mpm_worker

Considering conflict mpm_event for mpm_worker:

Considering conflict mpm_prefork for mpm_worker:

Enabling module mpm_worker.

To activate the new configuration, you need to run:

systemctl restart apache2

root@Debian-91-stretch-64-LAMP ~ # a2enmod php7.0

Considering dependency mpm_prefork for php7.0:

Considering conflict mpm_event for mpm_prefork:

Considering conflict mpm_worker for mpm_prefork:

ERROR: Module mpm_worker is enabled - cannot proceed due to conflicts. It needs to be disabled first!

ERROR: Could not enable dependency mpm_prefork for php7.0, aborting

like image 736
tb3d Avatar asked Sep 16 '17 20:09

tb3d


People also ask

How do I change MPM Prefork to worker?

You will see the keyword 'prefork' in the output. Then disable MPM prefork, with the following command. Next, enable MPM worker with the following command. Now verify that your Apache server is running MPM worker, with the following command.

How do I change Apache module in MPM?

You have to compile Apache with the desired MPM using the --with-mpm=MODULE NAME command line option to the config script. To change MPM, the binary must be rebuilt. You can determine which MPM Apache2 is currently built with by executing apache2 -l or httpd -l on the command line.

How do I enable MPM worker?

All i found was in CentOS at /etc/sysconfig/httpd just putting HTTPD=/usr/sbin/httpd. worker will make "worker mpm" enabled.

What is Prefork MPM and worker MPM?

Prefork MPM uses multiple child processes with one thread each and each process handles one connection at a time. Worker MPM uses multiple child processes with many threads each. Each thread handles one connection at a time.


1 Answers

I got the following error

sudo a2enmod php7.2 
Considering dependency mpm_prefork for php7.2:
Considering conflict mpm_event for mpm_prefork:
ERROR: Module mpm_event is enabled - cannot proceed due to conflicts. It needs to be disabled first!
Considering conflict mpm_worker for mpm_prefork:
ERROR: Could not enable dependency mpm_prefork for php7.2, aborting

And to fix I simply did

sudo a2dismod mpm_event
sudo a2enmod php7.2
sudo systemctl restart apache2

you might also want to try restarting your server

like image 108
Yehuda Clinton Avatar answered Oct 14 '22 12:10

Yehuda Clinton