Use these to jump around or read it all…
[What You Have To Be Able To Do]
[Section 1: A Place for the CGI]
[Making the CGI Directory]
[Section 2: The CGI and its HTML Document Buddy]
[Altering the HTML Document]
[Altering the CGI Script]
[Section 3: Send Them to Your Server]
[Section 4: “Turn On” CGI-BIN and Script]
[Possible Error Codes]
If you follow this tutorial, you will be guided through the steps to place a guestbook CGI onto your system. The CGI will, hopefully, work just the same as my guestbookCGI, mainly because it’s the same one. That makes sense. I will tell you though, it took me about two weeks to figure all this out. Placing a CGI is an involved process that requires your doing some configuration at the server level. It’s a little scary at first, but stick with me. You’ll get the hang of it soon enough.
This tutorial deals with UNIX servers and UNIX commands for configuration. The vast majority of Internet servers are UNIX-based. If your server does not use UNIX, consult your technician for additional instructions.
What You Have To Be Able To Do
In order to place your own CGI, you must be able to do a few things with your Internet account. You must be able to:
- Telnet into the system
- Create directories
- Change directory modifications
You must be able to do all of the above. If you can’t, you will not be able to install this guestbook CGI. You can either check with your server technician or just try following along. If you are denied any of the above items, the server will tell you soon enough.
Telnet
(Click for a short tutorial regarding telnet)
For those of you who don’t know, “Telnet” is another way to attach to your Internet server. Using telnet you are attaching directly to the server “shell.” This is where you can enter commands that directly affect the UNIX settings.
When you signed up with your Internet Service Provider (ISP) you should have gotten a telnet program. If you didn’t, you still may be in luck. Windows-based computers have telnet programs already installed. In versions 3.x, it’s named “Terminal.” In W95, it’s named “Telnet.” Both can be found under the Accessories section.
Whatever telnet you are using, they all work the same way. Open the program, choose to connect, and type in your WWW address without the http://.
You’re good to go. Keep following along….
Section 1: A Place for the CGI
Okay, here we go. First off, you will need to telnet into your server. Upon connecting, you will be asked for your user name and password. Put them in. Usually you will get a few welcome greeting messages and then a prompt of some sort will pop up. I have worked with seven different servers and the prompt has been different on all seven. It should look something like this:
telnet%
Does that look familiar? If not, don’t worry, you will see the blinking cursor where you will enter information.
Your Public HTML Directory
When you send files over to your server, for them to be seen by the entire Internet community, you send the files to a directory. It has a name. You need to find that name. Most of the time the name is something like “public-html” or “www” or “default.”
For the sake of demonstration, we’ll say the directory’s name is WWW. That’s the shortest name and thus easiest to write a couple hundred more times. Depending on how your system is set up, you will either be in that directory when you telnet in, or you will be one above it. The smart money is that you are one above it. Type this at the prompt:
telnet% ls
(Please note, I am using “telnet% to represent the prompt. Your prompt may look different)
Hit return. You will get back a listing (that’s what “ls” means) of everything in that directory. If you see all the names of your HTML documents that Internet viewers can access, then you are already in the WWW directory. If you see the name of your Internet directory (I called it WWW above), then you are one above the directory. This is probably where most of you are. This is where I want you to be, one above your WWW directory.
You need to get one level above your WWW directory if you’re not already. Do that by typing this at the prompt:
telnet% cd ..(two dots)
“cd” stands for “change directory.” That’s what you just did. Now put in the “ls” command again and you should see your WWW directory.
Making the CGI Directory
This may already have been done for you. You should check that first. If when you typed one of the “ls” commands above you saw a cgi-bin, you need not do this.
Now you will need to create a special directory for your CGIs. No, they cannot sit where all the other files are located. Why will become clear in a moment. I suggest you name the directory you are about to create “cgi-bin” as that is what I am going to call it the rest of the way through this tutorial. Please notice that is a hyphen between the “cgi” and the “bin.” You will make the directory by typing this:
telnet% mkdir cgi-bin
If you get another prompt and no error messages, you did it. This is the first point at which you may be told you do not have the ability to place a CGI.
If you’d like to see your work, type this:
telnet% cd ls
You should see your cgi-bin. However, some servers are set up that as soon as you create a new directory, you are then put into it. I had a school server do this once. It’s actually helpful if you want to place files right away. If you do the list command above and see nothing, you’re probably in the directory you just created. Type this:
telnet% cd ..(those two dots again)
…and then this:
telnet% ls
You should see the new directory “cgi-bin.” Log out of telnet by typing “logout” at the prompt.
Section 2: The CGI and Its HTML Document Buddy
Sounds like a new movie doesn’t it? Below are links to two items. The CGI and the HTML document that will use it. Grab them both. They are in text form so they should display as just text. Some browsers will display the HTML document as a form, though. If that happens, just download it.
Here is the CGI script
Here is the HTML document
You will need to save the CGI script as “gb.cgi” or with whatever suffix your server requires. Some servers use “.pl.” You will need to save the HTML document as “gb.html.” Save them both as “source” so they keep their shape.
Altering the HTML Document
You will need to make a few changes to the HTML document so it knows where the CGI is located. Look at this line: