1. Computing

Discuss in my forum

Installing a Guestbook - Build Your Own

Install a Guestbook on Your Own Server

By

This is a more advanced Web development article. It requires that you be comfortable with FTP and working with your hosting provider. You also must have access to CGI in a cgi-bin directory on your hosting provider.

Add a Guestbook in Your Own CGI Directory

If you don't want your Web site to be hosted remotely, and you have cgi-bin directory access on your Web hosting server, you can host your guestbook yourself.

Before you can install and run a CGI on your Web server, you need to find out if your hosting provider allows CGI access. This information should be in the support information for your provider, or you can write to the support department of your provider. (Note: Most free Web hosting services do not have CGI access.)

Most hosting providers that allow CGI access require that you place them in the cgi-bin directory. This directory won't be in the same directory as your HTML. For example, your HTML may be stored in /home/username/html and your CGI scripts are stored in /home/username/cgi-bin. Make sure you know where your cgi-bin directory is and that you have acces to it.

Once you have found your CGI directory, you need to find your CGI. There are many CGIs to choose from, and I'm not going to explain how to install a specific one. Rather, I will give instructions for installing any CGI on your Web site. A good place to find CGIs written in many different languages at the CGI Resource Index. There are over 50 Perl Guestbooks to choose from.

Steps to Install a CGI

Most CGI programs consist of one or more files to install on your Web server. For your specific CGI, you should follow the instructions in the install file, readme or other documentation that is usually included with the program itself. However, following is some general instructions for installing a CGI:

  1. Find the .pl or .cgi file and upload it to your Web server
  2. Put it in the cgi-bin directory
  3. Change the mode of the file (see below)
  4. Test the program

Changing the Mode of Your Guestbook

Most Web servers are Unix or Linux systems, and as such have two standard modes for files executable and non-executable. All files are automatically uploaded as non-executable for security. What this basically means is an executable file is a file that will do something when it is "run". In order to tell the Web server that your CGI program can be run, you need to change it to be executable.

In order to change the mode on your CGI programs, you need to have an FTP client that supports it or supports custom commands. To make your CGIs executable, you need to send the custom command:

SITE chmod 755 filename

With WS-FTP, you can right-click on the file you want to change. Just make sure you choose Execute in all three categories (owner, group and other). For other FTP clients, open a custom command line, and enter the command above (change the filename to your filename).

Testing the Guestbook

Testing your CGI is vital before you publish the URL on your site. It can be very difficult to determine why a program is not working correctly on a Web site. If you have problems, first be sure to read all the help documents that come with your CGI. Always make sure that your CGI program is executable. Even if you know you changed the mode to executable, you will not hurt it to change it again. If you have telnet access, you should try to run the CGI from the telnet command line - this will often show you the errors that are sent to the error logs when the Web browser looks at it.

Previous Page > Add a Remotely Hosted Guestbook > Page 1, 2

Previous Features

  1. About.com
  2. Computing
  3. Web Design / HTML
  4. Web Programming
  5. Installing a Guestbook - Build Your Own

©2014 About.com. All rights reserved.