Apache under Windows Page 6
Windows has no concept of looking for the #! (''shebang'') line, but does everything based on the file extension.
Apache lets you do things either way, as you like. If you are aiming for platform independence, it is very handy to be able to use the #! line, so that you can run your CGI programs on your Windows machine, and also on your Unix machine. But, if you are developing CGI programs only for Windows, then perhaps this does not matter to you, and you want it to execute based on the file extension.
The ScriptInterpreterSource directive tells Apache which one of these you prefer. The default value, script, tells Apache to look for a #! line to find out what interepreter to use to execute the program. Setting it to registry will cause Apache to look in the registry for the association between the file extension and a script interpreter to run it.
Tip: If you will be using Perl CGI programs, and want to maintain some level of portability between your Unix machines and your NT machines, you will want to install Perl in a location on your NT machine that is the same as on your Unix machines. For example, on my Linux machines, Perl is located at /usr/bin/perl and so every Perl program that I write begins with "#!/usr/bin/perl". So, when I install Perl on an NT machine, instead of installing it in the default location, which is c:\perl for ActivePerl (http://www.activestate.com/), I install it in C:\usr so that the Perl executable is located at /usr/bin/perl. This allows me to write code on my Windows machine, and then move it, without changes, to my Linux machine, and have it run there. And vice versa.
Many of the directives that work differently under NT are the ones you'd expect -- notably the ones dealing with forking child processes. As discussed above, NT does not use fork, but uses threads, to accomplish what Unix-type systems use fork for.
There are some other directives that you might want to use, but which you will need to think about a little differently on NT.
Some of these are just my observations. Perhaps someone can correct me on these.
Users on NT have user directories, but, as the comments in httpd.conf
# Under Win32, we do not currently try to determine the home directory of # a Windows login, so a format such as that below needs to be used. See # the UserDir documentation for details. # UserDir "C:/httpd/users/"
What this means is that you should just use UserDir in the normal way, except that you must specify an absolute path.
Under Unix, specifying a relative path causes Apache to append that path to the home directory of the user specified. That is, if the URL requested is http://www.rcbowen.com/~rbowen and UserDir is set to 'public_html', Apache will attempt to serve files from /home/rbowen/public_html.
However, on Win32, there's no nice way to figure out a user's home directory, so that syntax is unavailable.