PrevIndexNext

Introduction to CGI

There is a little web server downloadable from:
    http://www.ritlabs.com/tinyweb
With this installed you can have a web server on your very own computer and do CGI programming - which is VERY similar to just plain perl. CGI stands for "Common Gateway Interface".

To simplify the process of configuration of this little web server I have created this self-extracting zip file:

    www.exe
Click on the link above and save the file to "www.exe". Double click the www.exe file and extract it to the default directory:
c:\
This will create c:\www and under that:
root\ bin\ log\

Each time you boot or restart your system you need to go into the www\ directory and double click on the shortcut named TinyWeb to start the web server. The cursor will change to a busy cursor and after a little will change back to the normal arrow. This indicates that the tiny web server is running in the background and is ready to serve.

The CGI scripts you write should live in c:\www\root\cgi-bin and have a suffix of .pl for Perl scripts, as usual.

Open this location in the web browser:

    http://localhost/testform.html
This is a sample HTML file that contains a form. There is a Perl script (in c:\www\cgi-bin\) named hello.pl that will process that form after it is "submitted". All that the Perl script does is gather the contents of the fields of the form and print them out.

Study these files to see how it all works:

c:\www\root\testform.html c:\www\root\cgi-bin\hello.pl
Here is a link to a well written tutorial on creating HTML forms: tutorial

And here is a link to the complete documentation on CGI.pm written by its creator, Lincoln Stein:

    CGI Documentation
With this tiny but sufficient web server you can get your CGI programs tested out locally and then, when you are ready, upload them to your ISP - assuming your ISP allows CGI programs - not all do.

PrevIndexNext