prefork.c is not shown in httpd -l

1.6k views Asked by At

I have CentOS 7 and the version of my apache is 2.4.6. I typed this command:

httpd -l

This is the answer:

Compiled in modules:
  core.c
  mod_so.c
  http_core.c

Therefore, I cannot see the prefork.c among these modules. Also, I cannot see the prefork module in /etc/httpd/conf/httpd.conf but the answer of the httpd -V | grep "Server MPM" is:

Server MPM:     prefork

Moreover, the suggestion of these links is not helpful: apache2-prefork-dev installation Prefork MPM configuration not in httpd.conf ((It means that installing httpd-devel was not helpful, and adding following lines in /etc/httpd/conf.modules.d/00-mpm.conf did not fix my problem:

LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

StartServers           5
ServerLimit            256
MaxRequestWorkers      256
MaxConnectionsPerChild 0

)) I want to see prefork.c in the answer of httpd -l and also I want to see prefork module in /etc/httpd/conf/httpd.conf what should I do? Thanks for sharing.

1

There are 1 answers

2
J-M.D On

httpd -l only lists the modules that have been added at compile time in the server, as static modules.

Other modules can be loaded dynamically as DSO (Dynamic Shared Object) by calling them with the LoadModule directive in the conf file. You can list them (along with static ones) using httpd -M instead of httpd -l. If prefork module appears in the list, it's because it is loaded and at work.

Both methods, static and DSO, work well and you can (and probably should) use DSO without any issue.

Regarding the prefork config, it can be inserted directly in httpd.conf, or (as it seems to be your case) in another file, which is then "merged" in the server config with the Include directive in httpd.conf. You may find the prefork config you search by finding which included file it has been stored into (you should have a /etc/httpd/conf.modules.d/00-mpm.conf but at worst, opening them one by one should eventually give you some result). And if you really want to, you can cut it from there, and paste it directly into httpd.conf instead.

Finally, if you really want to see prefork module appear in static modules list, you will have to manually configure and compile apache sources, adding that specific module as static in the process.

You can read more about this on apache docs, and, should you decide to go that way, you'll probably find that this question is better suited for ServerFault website.