Don't Skip This Section

Previous Table of Contents Next

Don't Skip This Section

You're almost ready to write a CGI program. Almost. You need to check a few things first; otherwise, your first experience writing CGI programs will not be a happy one. It's much easier to check things before you write, rather than while you're debugging.

To use CGI, you need a web server. A common problem that new CGI programmers have is that they try writing CGI programs without having a web server properly installed. For obtaining a web server, you have a couple options: You can rent space on a commercial web server, or you can run your own. The decision is up to you, based on what you would like to pay, your bandwidth requirements, and how technically adept you are.

To obtain a commercial web server, surf the Web and find one. These commercial servers are commonly known as "web hosting" companies, and the rates they charge and the features offered can vary wildly. If you're planning on writing Perl CGI programs, you should be sure to check that Perl version 5 is supported as a CGI language. A very few web hosting companies do not support Perl as a CGI programming language or don't allow CGI at all. Avoid those companies; you have plenty of others to choose from.

You should also make sure that the web hosting company allows you to use your own scripts. Some companies claim that they allow Perl CGI but then require that you use their programsŚsometimes for a fee. You should avoid those companies as well.

Still other companies will charge a fee to "review" your CGI programs before you're allowed to use them. If you choose one of these companies, you should set up your own server for testing because this "reviewing" can be expensive.

Running your own personal web server isn't too difficult, if you have some technical skills and are willing to read through the instructions. First, you need to pick a web server. If you're running Windows, you can choose from dozens of free or nearly free web servers to install. Make sure they support Perl as a CGI scripting language. A few commercial web servers are also available for Windows, notably Microsoft's Internet Information Server (IIS).

If you have a Unix machine, a few commercial web servers are available. Contact your Unix vendor for a list.

The most popular web server on the Internet, Apache, is completely free. The Apache web server is easy to installŚif you have a C compilerŚand fairly easy to operate if you're comfortable editing configuration files. Apache is even available precompiled for the Microsoft Windows platform. For information on Apache, go to http://www.apache.org.

If you run your own web server, make sure that the web server is working properly and can serve static web pages before you attempt to write CGI programs. If your web server does not serve static web pages, it's very unlikely that CGI programs will work.

You should also check the configuration for the web server to make sure that you have CGI scripts properly enabled. Not having this feature enabled is the cause of most beginners' frustrations with CGI programming.

The Checklist

Whether you run your own web server or rent space from a commercial web host, take the time to complete the following checklistŚreally! Write down this information; it will save y

Previous Table of Contents Next
© 2000- NIV