Webmaster Setup Instructions for CGI Scripting with Perl

To the Classroom Webmaster:
Here are our software configuration requirements. This setup is necessary for our labs, exercises, and demos to work. Many thanks for your cooperation!
Classroom Software Setup Requirements
  1. Perl Interpreter
  2. Web Server

1. Perl Interpreter
  • Must be Perl 5.004 or later. Here are detailed instructions on how and where to get Perl.
  • On NT, filename extension .pl (and, optionally, .cgi) must be associated with the Perl interpreter. This enables the automatic invocation of the Perl interpreter by double-clicking on a .pl file's icon or by typing its name at a DOS prompt. Here is how to associate the .pl filename extension with the Perl interpreter. (Perform a similar procedure for the .cgi filename extension.) Make the association by typing the following commands at a DOS prompt (substitute as appropriate for your Perl interpreter path):
    assoc .pl=perl
    ftype perl=C:\perl\bin\perl.exe %1 %*

2. Web Server
The preferred configuration is a webserver on each student desktop machine. If this is difficult, other configurations (described below, in which the students share a single web server on one Unix or one NT machine) are possible.

If the webserver is on a single Unix host, shared by the all the students:

  • Let's say your httpd is running on a machine named strfleet.hpl.hp.com.
  • User config: Let's say the student's login is corp7. Each student has, or will create, beneath his home directory, a sub-directory named public_html.
  • Home pages: Thus, he would access his home page as http://strfleet.hpl.hp.com/~corp7.
  • Running CGI scripts: A script named, say, doit.cgi, in the student's public_html directory (or in a sub-directory thereof) would be invoked as http://strfleet.hpl.hp.com/~corp7/doit.cgi.

If the webserver is on a single NT host, shared by all the students:

  • Make sure that TCP/IP is installed. Obtain a static IP address from the network administrator or ask the network administrator to reserve your IP address through a DHCP Server.
  • Make sure that this IP address is in the company's DNS host tables. If it isn't, ask a network administrator to add it.

If you're using Microsoft's IIS web server:

  • Install MS IIS. Make sure that both its web server and its ftp server components are installed.
  • FTP Configuration:
    • Deselect "allow only anonymous connections."
    • Change the home ftp root to match the home web root directory, which is c:\inetpub\wwwroot by default
    • Allow read and write to the ftp root directory.
  • IIS document tree (web root) -- allow both read and execute in this directory.
  • To enable students to upload files to the webserver machine, create a user ID in NT, e.g. "training". Make sure this user has permission to create and modify files in the webserver's document tree.
  • Install Service Pack 3. Do this after installing IIS. It updates both IIS and NT 4.0. The Service Pack must be reinstalled after any part of the NT operating system is installed or upgraded.
  • Edit the registry as described below.
  • Stop and restart the Web service after any registry changes have been made.
Registry Key Value
HKEY_LOCAL_MACHINE
  \System
    \CurrentControlSet
      \Services
        \InetInfo
          \Parameters
            \MimeMap
set to .htm (REG_SZ, No string required.)
HKEY_LOCAL_MACHINE
  \System
    \CurrentControlSet
      \Services
        \W3SVC
          \Parameters
            \ScriptMap
Edit menu: add value, data type REG_SZ.
Type the filename extension used for Perl scripts (.pl or .cgi).
In the string editor, enter the full pathname of the Perl interpreter, followed by %1 %*, e.g.:
C:\Program Files\Perl\bin\perl.exe %1 %*

If each student has his or her own webserver on an NT desktop machine:

  • The setup steps are the same as above, except that you needn't worry about name servers and static IP addresses, because each student will be able to see his/her own machine as localhost.

File setup:

  • The files each student needs will be downloaded by the student as the first step in each lab when needed.

CGI policy:

  • This is the crucial part. The webserver must be configured to execute as CGI scripts any executable file with the filename extension .cgi and/or .pl.
  • On Unix, this is done by editing its srm.conf and access.conf files.
  • On NT with IIS, this is done by making the registry edits described above.
  • On either operating system with Netscape's FastTrack server, connect in your browser to its administrative server (password and special port number required), click the button labeled with the server's name, then click the button labeled "Programs", then set the appropriate value for "Shell CGI".

Testing:

  • Verify that your CGI setup works. Once you have the Perl interpreter installed, create a little CGI script and verify that each webserver runs it properly. The following Perl script would suffice:

    #!/usr/bin/perl
    # substitute path to perl interpreter as appropriate
    print "Content-Type: text/html\n\nHello World!\n";
    You'd invoke this in the browser via a URL such as:

    http://localhost/cgi-bin/hello.cgi
    where hello.cgi is the name of the script file (must be world-executable) and cgi-bin is the directory configured in the webserver for CGI scripts (substitute as appropriate).

We hope this makes sense!

Questions? Please contact us immediately!


Copyright © 2020

Dan Keller Technical Services
2248 International Blvd., Oakland
California, USA 94606
tel: 415 / 861-4500