how to make Apache 2.4 work in single worker mode by default?

3

I'm using Apache 2.4 on my server. My scripts are using a lot of system() commands and they require to work in one process mode.

When I start apache using the command:

apachetctl -X

(which normally is debug mode, which works as single process if I'm not wrong), it works fine. However if I start Apache as system daemon it doesn't work anymore and gives some pretty bizarre results.

I commented the following line in httpd.conf

LoadModule mpm_event_module modules/mod_mpm_event.so

it didn't helped, then I uncommented it and gave it the following configuration in httpd-mpm.conf file:

<IfModule mpm_event_module>
    StartServers             1
    MinSpareThreads          1
    MaxSpareThreads          1
    ThreadsPerChild          1
    MaxRequestWorkers        1
    MaxConnectionsPerChild   0
</IfModule>

But it still won't work. In the /etc/httpd/modules/ directory I have also other modules related to threading and processes:

mod_mpm_event.so
mod_mpm_worker.so
mod_mpm_prefork.so

I read in docs that they are supposed to be precompiled in Apache, but when I call the command apachectl -l all I get is this:

# apachectl -l               
Compiled in modules:
  core.c
  mod_so.c
  http_core.c

So, my question is the following. How to configure Apache 2.4 in order it would work in the same mode as if it was started with the command apachectl -X. Thanks very much.

Marek

Posted 2014-07-15T08:55:01.303

Reputation: 159

We do not consider RPi servers to be within the scope of Server Fault. The enthusiast nature of the device makes questions regarding them more appropriate for [su], [unix.se] or [raspberrypi.se]. – None – 2014-07-15T09:18:59.900

1But this problem is not hardware related. It will occur the same way on any other machine. The answer could be usefull for other people who are not using Pi, if I repost it on Raspberry Pi stack, they wouldn't find it. – None – 2014-07-15T09:21:19.830

I think it fits just fine. It's clearly hardware independent. An Apache configuration issue. Apache is Apache... – i-CONICA – 2014-07-15T09:24:48.913

We discussed this on meta http://meta.serverfault.com/questions/5586/are-raspberrypis-ever-on-topic-for-serverfault. We don't want SF flooded with RPi enthusiasts. @i-CONICA see that link too.

– None – 2014-07-15T09:39:51.500

>

  • this is not RPi question, this is Apache 2.4 question. 2. I edited the post, I don't mention RPi anymore. 3. If you wish I can reproduce the problem on my home rack server which has nothing to do with Pi.
  • And concerning your link, include Raspberry-Pis as a foundational element in the scenario, My PI is not a foundational element in this scenario, I did it on Pi, because it is portable and I can take it to the work in my pocket. – None – 2014-07-15T09:43:50.813

    Answers

    1

    What was missing is ServerLimit definition. Once I added it it solved the issue. Now all system() commands work fine and I have exactly the same behavious as in debug mode.

    <IfModule mpm_event_module>
        StartServers             1
        MinSpareThreads          1
        MaxSpareThreads          1
        ThreadsPerChild          1
        MaxRequestWorkers        1
        MaxConnectionsPerChild   0
        ServerLimit              1
    </IfModule>
    

    Marek

    Posted 2014-07-15T08:55:01.303

    Reputation: 159