Setup Perl, PFE, Omni httpd on W9x. Or on Linux

Most of these can be done in any order. This is how the Computer Lab machines are configured for CAPP 386.

on C:

create c:\capp386 folder, copy index.html to it, create c:\capp386\cgi-bin folder, copy to it

(index.html is the Capp386 home page. Go back to that page, use File pull-down Save As..) index.html is the page that's displayed when you go to the class web site. It's the bluish (aquamarine or turqoise) background page that says "Welcome to CAPP 386 home page!" Save that page as c:\capp386\index.html

( is in cgi-bin directory. Go to that directory from the home page, download


Required unless your system already has a Perl installed. For executing CGI programs written in Perl.
  1. download (1061K)
  2. unzip (make it create C:\perl5 folder)
  3. edit c:\autoexec.bat (with Pfe or some other editor). add ;c:\perl5\ntt to PATH line
  4. reboot so Path is reset
  5. start DOS (or if you've installed PFE run it, click DOS button). run path command to verify Path is correct (it should have the portion you just added to it).
  6. still in DOS: run perl command (just type perl on the command line). If get "Bad command or file name" error message then PATH is incorrect. Otherwise perl is running interactively, kill it with ctrl-c.
  7. Then run perl command with file as argument. Either give pathname to (perl \capp386\cgi-bin\ or first cd to cgi-bin folder and then perl Will get some lines of output (it's just to test that perl is accessible by system).

Omni web server

Required unless your system already has a web server installed.
  1. download ohttpd101.exe (948K)
  2. double-click it (it's a self-extracting archive file) Accept all defaults (except "do you want to start now" [say no] and "do you want to make it start at bootup" [say no])
  3. make shortcut icon on desktop called "Omni Web server"
  4. double-click icon (looks like nothing happens, but there'll be a blue globe in the task bar). double-click globe in task bar. In Admin.. Properties:
    1. Server..Server root: change to c:\capp386
    2. Server..Admin Email: change to your email address
    3. Standard CGI: select /CGI-BIN
      Virtual leave as is (/CGI-BIN). Change Actual: to c:\capp386\cgi-bin
      click Replace
    4. If you are going to use Omni but are using a different Perl than this one note that Omni expects perl to be in c:\perl5\ntt\perl.exe. So if your Perl is elsewhere, you'll need to change in Advanced..Perl CGI Command Line to the location of your Perl.
"server root" tells the Omni web server where to look for its html web files. Web pages retrieved by the server and sent to a browser will be located in the server root.

Microsoft Personal Web Server (PWS)

Some W9x's have this web server. You can use it if you want but I won't support it for this class (i.e. you're on your own if you choose to use it). You should change its "home root directory" to c:\capp386, its "default home page" to c:\capp386\index.html and its /cgi-bin directory to c:\capp386\cgi-bin so that you're consistent with the class. I'll assume that we're all configured the same. You can access the its properties via Control Panel. You'll also have to get it to execute the Perl .pl programs in /cgi-bin. Here is how to do so:
On the Start menu, click Run.
In the Open box, type "Regedit" without the quotation marks and click OK.
Open the following registry key:
On the Edit menu, point to New, and click String Value.
Name the value .pl and press Enter.
Select .pl, and click Modify on the Edit menu.
In the Value Data box:  \perl5\ntt\perl.exe %s %s
NOTE: this is the full path to perl.exe
NOTE: The "%s %s" is case sensitive. (e.g. "%S %S" will not work).
Close the Registry Editor, and restart your computer

After Perl and Omni installed:

  1. run Omni, point browser to URL localhost, should get "welcome to capp386" (the index.html). If don't, then probably Server root not set correctly.
  2. point to localhost/cgi-bin/ should get time page.
    if "Document contains no data" (Netscape) or the misleading message from IE "can't find ..." check that compiles and executes correctly from DOS: perl
When you point the browser to "localhost" you're telling it to go to the web site whose host (machine) name is localhost and get the default page from there. By convention, default page is usually index.html (the Omni properties, in Server tab, calls this page the "Default Index"). By convention, localhost is the name of the same machine that the browser is on, so pointing the browser to localhost is pointing it to the web server on the same machine. Pointing to localhost is NOT like opening a local file on c: drive. "Pointing" means put the address in the Adddress or Netsite location bar of the browser. So just type localhost in there, that's the web site you're going to. By pointing to localhost, the server gets the file and "downloads" to the browser; the server and browser just happen to be on the same machine. index.html is the default file to download if all you point to is the site name. When going thru the server (localhost), there is no specification about drives or capp386 directory.

To execute a Perl program you need to to execute the Perl interpretor in DOS. When you go thru the web server (meaning going thru localhost) and access a Perl .pl file in the cgi-bin directory the server will cause the Perl interpretor to execute to run the Perl program. The output of the Perl program is then downloaded to the browser. The output of a Perl program in cgi-bin (i.e. a CGI program) will be html code.
All our use of CGI will be thru the server (localhost). Opening a file in the browser by giving the name of the file on the machine does not use the server and thus CGI will not work. When it's running, Omni is waiting for requests to come from the Internet for web pages that it can serve up. Requests from a browser on the same machine (when you point the borwser to "localhost") are exactly like a request from a browser anywhere in the world to your Omni server (if your machine had a real IP address, i.e. if it was on the Internet).

The cgi-bin/ directory is for executable files only. Don't put any HTML files there. The server is configured to execute any "resource" in the cgi-bin/ directory.


Optional. A good editor for editing program source and HTML files. Notepad is a lousy editor.
  1. make folder C:\Pfe
  2. download (583K)
  3. unzip into the pfe directory you just created
  4. make shortcut of pfe32 as icon on desktop named PFE32
  5. double-click icon to check if works
  6. in Options..Preferences..Associations, make .pl and .js associated. This is so that double-clicking a .pl or .js file in W9x launches PFE to edit the file. Execute a stand-alone Perl program from DOS (can start DOS from within PFE via the DOS icon). Execute a JS program by opening the file in a browser.


If you're using Linux (or are planning to), it'll probably already have Perl and a web server (probably Apache) installed. If you're interested in webmastering and web servers, I suggest you use Linux with Apache (and they'll always be free).

In a command line shell, issue the perl command to see if perl is installed on your system.
Start a web browser (probably will be Netscape) and see if URL location localhost gets somewhere.

Your home directory, capp386 subdirectory, and cgi-bin subsubdirectory must be world searchable and cgi-bin must also be world readable. They must be accessible by the special user 'nobody' that the server runs as. To simplify, make all of them world r and x:
chmod 755 /home/yourhomedir
chmod 755 /home/yourhomedir/capp386
chmod 755 /home/yourhomedir/capp386/cgi-bin

Configuring Apache web server so that a subdirectory capp386 in your home directory can be accessed by yourhostname/capp386 (or localhost/capp386):
The following instructions refer to some of Apache's configuration files. Typically they are in /etc/httpd/conf/ but they might be elsewhere on your system; do:
find / -name httpd.conf -print
to find them if they aren't in the usal place. Add a line to file /etc/httpd/conf/srm.conf (you'll have to be logged in as root)
Alias /capp386 /home/yourhomedir/capp386/
where yourhomedir is the name of your home directory (assuming it's in /home).

Configuring Apache to change where it looks for CGI scripts:
In the same /etc/httpd/conf/srm.conf
1. Put a # in front of line ScriptAlias /cgi-bin/ /home/httpd/cgi-bin/
2. Add a line:
ScriptAlias /cgi-bin/ /home/yourhomedir/capp386/cgi-bin/
Then you need to restart httpd (that's the process name of the web server). Find its pid with ps -x command (or look at file /var/run/, then
kill -1 pid_of_httpd
Test by copying into your capp386/cgi-bin/ and then in browser accessing localhost/cgi-bin/ and you get the date information page.