46

Where I can get information about what kind of MPM Apache is using in my Linux system?

Tom Fenech
  • 72,334
  • 12
  • 107
  • 141
zim32
  • 2,561
  • 1
  • 24
  • 31

5 Answers5

71
httpd -V

then look for the Server MPM line.

Example:

# httpd -V
Server version: Apache/2.2.15 (Unix)
Server built:   Aug  2 2013 08:02:15
Server's Module Magic Number: 20051115:25
Server loaded:  APR 1.3.9, APR-Util 1.3.9
Compiled using: APR 1.3.9, APR-Util 1.3.9
Architecture:   64-bit
Server MPM:     Prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/prefork"
alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
Shatiz
  • 779
  • 1
  • 6
  • 15
  • Similarly to what was mentioned in the [comments beneath the currently accepted answer](http://stackoverflow.com/questions/6225404/how-to-find-what-mpm-model-apache-is-using-in-linux-worker-prefor-or-event#comment31195765_8639774), on some systems (such as Ubuntu) you should use `apache2 -V`. – Tom Fenech Nov 03 '14 at 17:28
  • 13
    `apache2 -V` does not look anything like the output above (for me), however `apachectl -V` do. – Zitrax Apr 28 '15 at 14:57
45

noticed the previous answers don't mention apachectl !

[dlam@some-ubuntu-box~] $ apachectl -V | grep -i mpm

Server MPM: event

--

[dlam@some-fedora-box:~] $ httpd -V | grep -i mpm

Server MPM: Prefork

David Lam
  • 4,689
  • 3
  • 23
  • 34
  • Another option is to list Compiled in modules using following command: `/usr/sbin/apache2 -l` And in the output look for worker.c, prefork.c or event.c as one only of them will be present indicating the respective MPM module your apache2 is using. – sactiw Jul 28 '14 at 12:29
  • @okwap as from @JorgeeFG answer this `a2query -M` works on Ubuntu – NineCattoRules Mar 23 '16 at 18:39
  • 1
    For me that was the only working method, because all others did not show any MPM. apach2 -V showed "Server MPM:" and nothing more. In my case "event" was enabled. – randomcontrol May 07 '20 at 10:28
35

In Ubuntu 14.04

a2query -M

Tells event, prefork, worker

You can change it by adding symbolic links for mpm_<chosen> from mods-available to mods-enabled in /etc/apache2.

Only one is allowed in a time.

JorgeeFG
  • 5,651
  • 12
  • 59
  • 92
  • 1
    Exactly what I needed! Thanks! –  Mar 23 '16 at 09:02
  • For some reason on my (AWS) Ubuntu 14.04, none of the required environment variables are defined, so none of the other solutions work. This one did. – msanford Aug 15 '16 at 21:54
15

You can see this by checking which modules are compiled with Apache.

See output of the following command:

# httpd -l

From there, seek for prefork.c.

PeeHaa
  • 71,436
  • 58
  • 190
  • 262
virt
  • 206
  • 2
  • 3
1

If it is linux,it should be prefork by default. Read here for more information about apache mpm.

Jasonw
  • 5,054
  • 7
  • 43
  • 48