Apache under Windows Page 4

On Unix, Apache forks multiple child processes, each of which listens for and serves requests, maintaining contact with the parent process. After a while, a child will die off, and the parent process will fork a new process to take its place. There are a number of configuration directives that let you control this behavior -- how many processes are forked, the maximum, and minimum, number of processes that can be going at any one time, how log a process is allowed to live, and so on.

On NT, there's no such thing as forking, and so this had to be handled differently. There are two Apache processes running on your NT machine. One of them is the parent process, and the other is the child process that actually handles requests. Within this child process, there are multiple threads, which can serve requests simultaneously. There can be a large number of threads at the same time, and Apache creates additional threads, as necessary, in much the same way that it forks new child processes on Unix.

Whether forking or threading is better, for some value of ''better'', is a discussion for another day. There are strong opinions on either side of the argument, and this is rather beyond the scope of what we're talking about.

General configuration tips

Unix and Windows refer to files differently. Windows has the notion of drive letters, which Unix systems don't have. And, by whatever twist of history, Unix uses forward slashes (/) to denote directories, while Windows/DOS uses back slashes (\).

The general rules are this:

  • You don't have to specify the drive letter if the resource is on the same drive letter as your ServerRoot. So, if, for example, you have
         ServerRoot "c:/httpd"

    Then you do not need to specify drive letters in other directives

         Alias perldocs /perl/html

    But you can if you want to

         Alias perldocs C:/perl/html

    And, as with Apache on Unix, relative paths are assumed to be relative to the ServerRoot, and so don't require any disk path.

         PidFile logs/httpd.pid

  • You should use quotes around any disk path with spaces in it. You should probably avoid using spaces in disk paths, on general principle, but Apache handles them correctly, if you feel the need to use them.

    There was a bug in earlier versions of Apache that caused problems when trying to run CGI programs from paths with spaces in them, which was especially irritating, because Apache installs in ''C:\Program Files\Apache Group\Apache'' That was when I developed the habit of installing in ''C:\httpd'', which has stuck with me, even though the bug has gone away since then.

  • Use forward slashes, or back slashes - whichever makes you happiest. You may find some strange places where back slashes appear to not work for you, and you can avoid most of these by using forward slashes, but in most cases, you can use whatever you're used to.

    For example:

         alias /perldocs c:\perl\html

    worked, and

          alias /perldocs /perl/html

    worked, but

          alias /perldocs \perl\html

    did not. I did not really think that this was a bug, since ordinary users would probably not ever use that notation, so this probably does not actually matter to anyone.

NT-specific configuration directives

This article was originally published on Jan 17, 2001

Thanks for your registration, follow us on our social networks to keep up-to-date