5.2. Starting the Server in Single-Process Mode
When developing new code, it is often helpful to run the server in single-process mode. This is most often used to find bugs in code that seems to work fine when the server starts, but refuses to work correctly after a few requests have been made. It also helps to uncover problems related to collisions between module names.
Running in single-process mode inhibits the server from automatically running in the background. This allows it to more easily be run under the control of a debugger. The -X switch is used to enable this mode:
panic% /home/httpd/httpd_perl/bin/httpd_perl -X
panic% /home/httpd/httpd_perl/bin/httpd_perl -X &
Note that in -X (single-process) mode, the server will run very slowly when fetching images. Because only one request can be served at a time, requests for images normally done in parallel by the browser will now be serialized, making the page display slower.
Also note that when running with -X, the control messages that the parent server normally writes to error_log (e.g., "server started", "server stopped", etc.) will not be written anywhere. httpd -X causes the server to handle all requests itself without forking any children, so there is no controlling parent to write the status messages.
Usually Ctrl-C is used to kill a server running in single process mode, but Ctrl-C doesn't constitute a clean shutdown. httpd.pid doesn't get removed, so the next time the server is started, the message:
[warn] pid file /home/httpd/httpd_perl/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
will appear in error_log. You can ignore this warning; there's nothing to worry about.
Copyright © 2003 O'Reilly & Associates. All rights reserved.