
For about the last week I’ve been trying to tweak the performance of a particular Apache server with varying degrees of success and failure. The biggest frustration is that I haven’t been able to find a way to determine which MPM mode Apache was running in: Prefork or Worker. Without that information I couldn’t tell if I needed to edit the <IfModule prefork.c> or <IfModule worker.c>sections of my httpd.conf file.
Today, I finally found the answer (thanks to user ‘andol‘ at StackOverflow!) and in the interest in spreading the data around and making sure it’s more accessible, here is how to tell which mode Apache is running in: Prefork or Worker.
PROBLEM
The main issue with finding this information is that the MPM (prefork or worker) is compiled into the Apache binary and not loaded as a module, so it’s not as simple as looking at the LoadModule list in your Apache config. You actually have to ask the Apache binary (/usr/sbin/httpd on my CentOS 5.3 machine) which modules it has compiled in to find out what you are running.
TIP: You can easily find the name of your Apache binary by cat‘ing your /etc/init.d/httpd script and checking the top of it for the httpd argument, for example, this was about 30 lines down in my script (highlight added):
# Path to the apachectl script, server binary, and short-form for messages.
apachectl=/usr/sbin/apachectl
httpd=${HTTPD-/usr/sbin/httpd}
prog=httpd
pidfile=${PIDFILE-/var/run/httpd.pid}
lockfile=${LOCKFILE-/var/lock/subsys/httpd}
RETVAL=0
SOLUTION
You need to pass the “-l” argument to the Apache binary to have it list off the compiled in modules. When I do that on my CentOS 5.3 machine, I get the following (highlight added):
[root@localhost ~]# /usr/sbin/httpd -l
Compiled in modules:
core.c
prefork.c
http_core.c
mod_so.c
You can see above that I’m running in Prefork mode because I have the Prefork module compiled in. That means I want to edit the values I find under the <IfModule prefork.c> of my httpd.conf file.
Update #1: Reader Raleigh says you can also use the following command:
httpd -V | grep MPM
Which will return a reply that indicates the MPM being used.

Just what I was looking for.
Thanks,
jodo
Most welcome, glad it helped!
Perfect, thanks Ryad Killa
Best regards from Peru
You are welcome!
I’m on ubuntu 9.10 and installed the LAMP package…I found I had to use apache2 instead of httpd… as in
/usr/sbin/apache2 -l
Compiled in modules:
core.c
mod_log_config.c
mod_logio.c
prefork.c
http_core.c
mod_so.c
If server info is enabled, you can simply check that.
/$.02
Good pt Chris
You can simply try this command instead:
# httpd -V | grep MPM
and it will returned this:
Server MPM: Prefork
-D APACHE_MPM_DIR=”server/mpm/prefork”
Thanks Raleigh, I’ve updated the post with your tip as well.
Thanks Riyad, saves my day.
On my debian having apache2, I had to /usr/sbin/apache2 -l to get the list of compiled modules.
Most welcome Pavan, glad we could help!
u dont need to put httpd -V | grep MPM
just: httpd -V
and u’ll get this:
Server version: Apache/2.2.3
Server built: Aug 30 2010 12:28:40
Server’s Module Magic Number: 20061215:3
Server loaded: APR 1.2.7, APR-Util 1.2.7
Compiled using: APR 1.2.7, APR-Util 1.2.7
Architecture: 64-bit
Server MPM: Prefork <<—————–THIS IS IT
threaded: no
forked: yes (variable process count)
Server compiled with….
and the list of compiled options
best regards guys
Dany, nice and simple, thanks!