Appendix D Windows CGI Progams
Installing Windows CGI Programs
This section discusses how to install Windows CGI Programs. The following
topics are included in this section:
Overview of Shell CGI Programs for Windows
Shell CGI is a server configuration that lets you run CGI applications
using the file associations set in Windows.
For example, if the server gets a request for a shell CGI file called hello.pl, the server uses the Windows file associations to run the
file using the program associated with the .pl extension.
If the .pl extension is associated with the program C:\bin\perl.exe, the server attempts to execute the hello.pl file
as follows:
c:\bin\perl.exe hello.pl
The easiest way to configure shell CGI is to create a directory in your
server's document root that contains only shell CGI files. However, you can
also configure the server to associate specific file extensions with shell
CGI by editing MIME types from the Sun Java System Web Server. For more information
on using the CGI, see Chapter
3, Using Common Gateway Interface, in Sun Java System Web Server 7.0 Update 3 Developer’s Guide
Specifying a Shell CGI Directory (Windows)
To create a directory for your shell CGI files, perform the following
steps.
To Create a Directory for your Shell CGI Files
-
Create the shell directory on your computer. This directory does
not have to be a subdirectory of your document root directory.
-
From the Home page, select the virtual server and Edit Virtual
Server>Content Handling>CGI (sub tab)
-
Click the New button in the CGI directories table
A
new window appears
-
In the URL Prefix field, enter the URL prefix you want to associate
with your shell CGI directory.
For example, suppose you store
all shell CGI files in a directory called C:\docs\programs\cgi\shell-cgi, but you want users to see the directory as http://www.yourserver.com/shell/. In this case, you
would type shell as the URL prefix.
-
In the Directory field, enter the absolute path to the directory
you created.
Note –
The server must have read and execute permissions to this directory.
For Windows, the user account the server runs as (for example, LocalSystem) must have rights to read and execute programs in the shell CGI
directory.
-
Select the CGI or Shell CGI option.
Make sure that
any files in the shell CGI directory also have file associations set in Windows.
The server returns an error if it attempts to run a file that has no file-extension
association.
-
Click OK.
Specifying Windows CGI as a File Type
You can use the Sun Java System Web Server MIME Types window to associate
a file extension with the shell CGI feature. This is different from creating
an association in Windows. To associate a file extension with the shell CGI
feature in the server for example,
you can create an association for files with the .pl extension.
When the server gets a request for a file with that extension, the server
knows to treat the file as a shell CGI file by calling the executable associated
in Windows with that file extension.
To specify a file extension for Windows CGI files,
perform the following steps
To Specify a File Extension for Windows CGI files
-
Create the shell directory on your computer. This directory does
not have to be a subdirectory of your document root directory.
-
Navigate from Common Tasks > Configurations (Select configuration)
> General >Mime Types (sub tab)
-
Click the New button to create a mime type
A new window
appears
-
Add a new mime type with the following settings:
-
Mime Header: Select the mime header from the following Content-type, Content-encoding, Content-language
-
MIME Value: magnus-internal/wincgi.
-
File Suffix: Enter the file suffixes that you want the server
to associate with shell CGI. If you activated CGI, WinCGI, and shell CGI file
types, you must specify a different suffix for each type of CGI. For example,
you cannot use the suffix .exe for both a CGI program and
a shell CGI program. If you need to, you can edit the other MIME type fields
on the page so that the suffixes are unique
-
Click the OK button