How to Check if Apache is Running Prefork or Worker

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.


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.


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:

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.

, , , , , , ,

21 Responses to How to Check if Apache is Running Prefork or Worker

  1. jodo September 1, 2010 at 8:02 am #

    Just what I was looking for.

    • Riyad Kalla September 1, 2010 at 8:26 am #

      Most welcome, glad it helped!

  2. Excelent October 15, 2010 at 9:56 am #

    Perfect, thanks Ryad Killa

    Best regards from Peru

  3. mike November 25, 2010 at 7:23 am #

    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:

  4. Chris Weekly December 15, 2010 at 12:13 pm #

    If server info is enabled, you can simply check that.

  5. Raleigh Guevarra January 10, 2011 at 6:50 pm #

    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”

    • Riyad Kalla January 11, 2011 at 9:14 am #

      Thanks Raleigh, I’ve updated the post with your tip as well.

  6. Pavan Mishra January 26, 2011 at 2:15 am #

    Thanks Riyad, saves my day.

    On my debian having apache2, I had to /usr/sbin/apache2 -l to get the list of compiled modules.

    • Riyad Kalla January 28, 2011 at 8:46 am #

      Most welcome Pavan, glad we could help!

  7. dany February 9, 2011 at 11:55 pm #

    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 :-)

  8. Goran Miskovic June 11, 2012 at 2:34 pm #

    $ which apache2

    sounds way much easier then cat /etc/init.d/httpd find on line 30 … :)

  9. jp July 5, 2012 at 3:57 am #

    THanks!! Have mamp installed on my mac and for the life of me was trying to figure out which MPM was installed.

    By default, prefork is compiled in the httpd.


  10. Patrick October 4, 2012 at 5:54 am #

    Thanks a lot!

  11. Ahmad Alfy March 13, 2013 at 4:52 am #

    Thanks so much, any one familiar with how to find the MPM used for Apache on Windows?

  12. Chris March 16, 2013 at 4:42 am #

    The answer is absolutely and completely incorrect.

    The question was, how to tell is Apache is RUNNING prefork or worker. The advice given only tells what the *default* MPM is for Apache (based on compiled-in modules), not if that default is overridden. If httpd -V shows prefork, that just means prefork is the default. That can be overridden by changing an Apache config file setting (e.g. in /etc/sysconfig/httpd on CentOS) — by adding or uncommenting a line that says HTTPD=/usr/sbin/httpd.worker, then restarting Apache, the MPM being used will be worker (can be shown for example using the Apache server-info handler), while httpd -V still shows prefork (since that is a list of compiled-in modules and default options, not the current effective value of the options).

    • Vinod July 10, 2013 at 1:20 pm #

      To find what is the ‘current’ mpm, just do a ps -ef | grep httpd. It will list out either httpd.worker or httpd.prefork (or any other)

  13. I V Prasad Reddy June 4, 2014 at 12:40 am #

    This is great…Thanks for explanation


  1. Weitere Apache-Probleme nach dem Umzug: Apache für Wordpress und begrenzten Speicher konfigurieren « Wissenswertes - October 6, 2012

    […] hat, und welche Optionen dieses Modul unterstützt. (Man kann mit /etc/init.d/apache2 -l oder ähnlichem herausfinden, welches Modul aktiv ist). Eine (für mich) falsche Liste von für einen […]

Leave a Reply