4

I have just updated from 12.04 to 14.04 and now have difficulty setting up Apache 2.4 I am getting the following error:

Setting up apache2 (2.4.10-1+deb.sury.org~trusty+1) ...
ERROR: Module mpm_prefork is enabled - cannot proceed due to conflicts. It needs to be disabled first!
dpkg: error processing package apache2 (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 apache2
E: Sub-process /usr/bin/dpkg returned an error code (1)

How can I disable the mpm_prefork so that Apache can continue?

DanielAttard
  • 143
  • 2
  • 2
  • 10

3 Answers3

7

I would use the proper command to disable a mod in Apache:

sudo a2dismod mpm_prefork
Renato
  • 71
  • 1
  • 2
  • I just get `Module mpm_prefork already disabled`. My situation is that php7.2 didn't install itself into apache2.4 correctly, and I can't fix it because this command doesn't work. – CoderGuy123 Aug 27 '19 at 23:30
  • Thank, For me other disables was needed before: `sudo a2dismod php8.1; sudo a2dismod mpm_prefork; sudo systemctl restart apache2` – Wellington1993 Jan 02 '23 at 14:47
5

You should try to remove the symlinks /etc/apache2/mods-enabled/mpm_prefork.{conf,load}:

rm /etc/apache2/mods-enabled/mpm_prefork.{conf,load}

Then relaunch the configuration of the apache2 package:

apt-get install -f

Or:

apt-get install apache2

But more important, you should ask yourself how these were installed there before hand. You might have copied an older /etc/apache2 directory with these (for instance) before launching apt-get install apache2.

vaab
  • 1,074
  • 1
  • 12
  • 19
3

There are apparently 3 different versions of this module (mpm_worker vs mpm_prefork vs mpm_event), and the error code can be misleading. Try disabling all three variants and then reinstalling. In my case (Mint 19.1/Ubuntu 18.04, php7.2), was the third:

root@machine:/var/www/html# sudo a2dismod mpm_worker
Module mpm_worker already disabled
root@machine:/var/www/html# sudo a2dismod mpm_prework
ERROR: Module mpm_prework does not exist!
root@machine:/var/www/html# sudo a2dismod mpm_event
Module mpm_event disabled.

After this, installing the apache php mod worked (sudo a2enmod php7.2) and the code was executed correctly.

CoderGuy123
  • 404
  • 1
  • 4
  • 12