Servers Apache under Windows Page 6

Apache under Windows Page 6




ScriptInterpreterSource
On Unix, the first line of a script file, such as a shell script, or a
Perl program, indicates what interpreter is to be used to run the
program. That line will look something like:

     #!/usr/bin/perl

or

     #!/bin/sh

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.

Directives that don't work on NT (or, at least, work differently)

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.

UserDir

Users on NT have user directories, but, as the comments in httpd.conf
note,

      # 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.

XBitHack

Latest Posts

How to Convert a Physical Computer to a Virtual Machine

Many organizations are implementing virtualization technology into their networks to convert physical computers to virtual machines (VM). This helps reduce overall physical hardware costs,...

HPE ProLiant DL380 Gen10: Rack Server Overview and Insight

The HPE ProLiant DL380 series has consistently been a market leader in the server space. The Gen10 released in 2017 further increased HPE's market...

Best Server Management Software & Tools 2021

Finding the best server management software tools for your organization can have a major impact on the success of your business operations. Manually handling...

IBM AS/400: Lasting the Test of Time

Some server operating systems (OS) were built to survive the test of time – the IBM AS/400 is one such system.  The AS/400 (Application System/400)...

What is Disaster Recovery?

The modern organization's heavy dependence on using data to drive their business has made having a Disaster Recovery (DR) plan in place a necessity....

Related Stories