Troubleshooting tips for Apache, Part 4 – Run Apache HTTP Server as a single process

Run Apache HTTP Server as a single process and use debugging tools

A typical Apache HTTP Server installation runs with several processes. However, to simplify troubleshooting it’s best to run Apache as a single process. This can be done by using the X option when starting Apache. The example below will start Apache in a single process mode, where Apache will not fork any new children or detach from the terminal.

$ httpd –X

Following this all traffic and communications will pass through one process, allowing troubleshooting procedures to be used on a single process instead of multiple processes. You would then be able to run the Apache httpd under a debugger, obtain a backtrace of a crash, and also force the server to perform a core dump. The official Apache developer resources found here explain how to do all this in more detail for Apache servers running on both Windows and Unix systems.

Issues with script execution

Dynamic content is generally served through scripts which are executed by Apache HTTP Server through the mod_cgi module. This module includes its own logging mechanism for recording any errors encountered during the execution of these scripts. After enabling the ScriptLog directive, mod_cgi will record the output of any scripts that did not execute as intended, including the server response code, the request that was received, and any response that was issued to the client. To enable this, you need to modify the httpd.conf configuration file and specify the ScriptLog directive and the location where the logs will be saved, as indicated below.

ScriptLog logs/cgi_log

Share this post

Leave a Reply

Your email address will not be published.