Hooking a CGI script to your Instant Web Site


What are CGI scripts ?

If you are not familiar with what a CGI script is, click here.

How do I hook my CGI script up to my Instant Web Site ?

To hook up a CGI script to your Instant Web Site, you need to do the following 6 steps.
1. The first part of setting up a CGI script is to write the HTML document that will call the script. This is usually a form, and can be done using the standard HTML language for forms. For help with writing forms, please refer to Instant Web Sites World Wide Help, CGI Scripts and Forms.

2. The next step is to write the CGI script that will do something with the information passed to it from your form. This script can be written in Perl, C or as a shell script. For help with writing scripts, please refer to Instant Web Sites World Wide Help, CGI Scripts and Forms.

3. Once you get your form designed, and have written the script for it, you need to know how to hook it up on our system.

In your home directory you will find a directory called cgi-bin. (Your home directory is where you are when you first FTP in to your account.) Place all of your CGI scripts in this directory.

4. Make sure that the filename of your CGI script ends in .cgi (for C or shell scripts) or .pl (for perl scripts).

This is very important!!
If you do not do this, the server will not be able to execute your script.

5. On Unix systems (which is the system that InfoStreet runs on), script files must be executable before you can run them. Using your FTP software, change the permissions of the CGI script file to be executable. This can be done with the following command:

chmod +x your_script_name

or alterantively, you can use the Make Executable tool to change the permission of your CGI script file to be executable. This is a MUST. Your CGI scripts will not run unless they have executable permission.

6. The last step is to tell your form, where the script is that it is supposed to execute. Tell the html document calling the script that the path name to execute the script is,

/X/XXX/cgi-bin/the_name_of_your_script

where XXX is the name of your site. (i.e. if your URL is http://www.InstantWeb.com/D/dolphin then your site name is dolphin), and X is the first letter of your site name as in d for dolphin.
the_name_of_your_script is your scripts name, like information.pl.

For Example

Suppose that you wrote a form called information.html that asked for information about your users. Then you wrote a CGI script called information.pl (lets make it a perl script) to collect that information. Next you made sure the script worked, placed it in your cgi-bin directory, and made it executable. Now you want to place a line in the HTML form information.html to call the CGI script information.pl. To do this, you need to know your site name. Lets assume for this example it is dolphin.

If you are using the POST method in your information.html form, you would need to use the following line.

<form method=POST action="/d/dolphin/cgi-bin/information.pl">

The above line tells the form to execute the script information.pl, in the directory /d/dolphin/cgi-bin. Or in other words, execute the script that is in your cgi-bin directory.


InfoStreet's Instant Web Sites Home Page InfoStreet's Instant Web Site Sign Up Form InfoStreet's Instant Web Site Help Pages InfoStreet's Instant Web Site Tools Other InfoStreet's Instant Web Sites Search InfoStreet's Instant Web Sites

Instant Web Sites are a service of InfoStreet Inc.