Basic CGI Information

Frequently Asked Questions (FAQ's) on CGI.

  1. I have heard alot about CGI "scripts" and CGI "programs". What is the difference between "scripts" and "programs"?
  2. What kind of CGI's can I run on the webserver?
  3. I have installed a CGI script on the server but when it is run it sends an "Internal Server Error" back to my web browser. What causes this, and how can I fix it?
  4. My website has an e-mail form that my customers will submit with credit card numbers. I need for this information to be secure. Can I use SSL to keep this information secure?
  5. I am not familiar with scripting. Will technical support help me compose a simple script?
  6. I am a programmer and would like to know what Perl related modules and peripherals are installed on the server.
  7. Before I begin writing custom scripts for my account, does Technical Support have any specific suggestions?
  8. I want a CGI script to run automatically when people type in http://www.mydomain.com Is there any way I can run a CGI script instead of my sites visitors seeing the standard "index.html" page?
  9. Pending
  10. Pending
  11. What other resources can I look to for further help in the CGI area?

1. I have heard a lot about CGI "scripts" and CGI "programs". What is the difference between "scripts" and "programs"?

There are different schools-of-thought on this subject. Strictly speaking, there is a difference. The difference lies in that "programs" are executed by the server, and "scripts" are interpreted by the server. CGI programs written in C tend to run 3 times faster than scripts written in Perl. In most cases this difference in speed is so small that it would only be noticeable in very large CGI's. Though C may be faster, Perl on the otherhand has access to a myriad of modules that make it possible to easily accomplish your CGI goals in contrast to using C. One of the main differences between Perl scripts and C programs is "portability". Perl scripts will run on any server that has Perl installed on it. On the other hand, "C" CGI programs must be compiled by the same operating system that the website is hosted on. If you compile a "C" CGI program on SGI Unix, you cannot then run the program on BSDI Unix.


2. What kind of CGI's can I run on the webserver?

You have the ability to run "C", Perl, and Shell CGI's. "C" CGI's must be compiled on the SAME operating system version that you are going to run them on. If you do not have shell access to a server with the same version of UNIX as the one you are hosted on with us, you will then need to write a shell script that will compile the *.c file for you. We do not yet offer the service of compiling C programs for our customers.

Perl scripts must have the first line as: #!/usr/local/bin/perl

Shell (Bourne) scripts must have the first line as: #!/bin/sh


3. I have installed a Perl CGI script on the server but when it is run it sends an "Internal Server Error" back to my web browser. What causes this, and how can I fix it?

An "Internal Server Error" can be caused by several things such as:
1.) The permissions on your cgi-bin directory are not set to 755.
2.) The permissions on your script are not set to 755.
3.) The script was uploaded in binary mode instead of ASCII mode.
4.) The script has a syntactical or logic error coded into it.
5.) The "shebang" (#!/usr/local/bin/perl) is not left-justified and bordering the very top of the script.

First, to see if your cgi-bin is working correctly you can access the "test.cgi" that is found in your cgi-bin. To do this, just type in your web browser http://www.yourdomainname.com/cgi-bin/test.cgi

If the message "The Common Gateway Interface is functioning normally" appears, then the cgi-bin permissions are fine.

You can check the syntax of your Perl script using the "Check your Perl script" tool found in your website's Control Panel.

You can change the permissions of your files with an FTP program such as WS_FTP.


4. My website has an e-mail form that my customers will submit with credit card numbers. I need for this information to be secure. Can I use SSL to keep this information secure?

The answer is yes and no. If you use SSL, the e-mail will only be secure until the e-mail reaches the webserver, after that the e-mail will be unsecure as it traverses the rest of the system. An alternative to using an e-mail form is to use a form that will send the information to the webserver, then write the information to a file that you could view with your web browser via SSL. A "Guest Book" script would accomplish this. Basically you would edit the HTML in a guest book form so that it looks like you want it to. Then when people submit the data, the cgi script that the form utilizes will write the data to the file that the guest book normally writes to. The next step is to create a password protected directory for the file. You would then point your web browser to the file in the directory using an https prefix. At that point you would be prompted for a username and password. Now you would be viewing the document securely. If you are not familiar with HTML and setting up forms then this may not be an easy task to accomplish. Our Technical Support department supports the unedited standard forms available through your website Control Panel, but we cannot assist in customizing forms or scripts.


5. I am not familiar with scripting. Will technical support help me compose a simple script?

Unfortunately, there are no simple scripts worth composing. The very nature of the complexity of CGI programming (and its time intensive requirements) prevent us from assisting with custom scripts. CGI programming is a "language", that in order to be used effectively, must be learned just like a natural foreign language. The alternative is for you to utilize the many CGI scripts/programs that can be found at the links listed at the bottom of this page.


6. I am a programmer and would like to know what Perl related modules and peripherals are installed on the server.

 Here is the list of Perl modules and related items installed on a webserver:

Perl version:
perl5.00503


 Modules in addition to the standard Perl modules:
Crypt-SSLeay-0.07
DBI-1.06
Data-ShowTable-3.3
Digest-MD5-2.04
GD-1.18
HTML-Parser-2.22
MIME-Base64-2.11
Msql-Mysql-modules-1.2017
Net-Telnet-3.01
URI-1.00
libnet-1.0606
libwww-perl-5.41

Also, by way of CyberCash, the following modules:
In the directory, '/usr/local/perl5/site_perl':

CCMckDirectLib3_2.pm
CCMckErrno3_2.pm
CCMckLib.pm
CCMckLib3_2.pm

7. Before I begin writing custom scripts for my account, does Technical Support have any specific suggestions?

Yes, there is at least one suggestion. It is suggested that when you compose your CGI scripts, in lieu of using "absolute server paths", that you, instead, use the evironmental variable "DOCUMENT_ROOT". The purpose for this is that "absolute paths" in your scripts, such as "/u22/username/mydir/", are SERVER SPECIFIC. If you upgrade your account later, which requires that your site be moved to server, say "u21" for example, your script paths would need to be changed to /u21/username/mydir/. If your CGI's are written in C, you would need to edit the source, then recompile the code.

To use the "DOCUMENT_ROOT" variable you would write $ENV{DOCUMENT_ROOT}/mydir/index.html instead of /www23/ username/mydir/index.html


8. I want a CGI script to run automatically when people type in http://www.mydomain.com Is there any way I can run a CGI script instead of my site's visitors seeing the standard "index.html" page?

Yes, there is a way to serve up another page other than index.html. This is done using the "DirectoryIndex" option in your .htaccess file. This method IS NOT recommended on accounts using FrontPage extensions.

If you add the following DirectoryIndex argument to your .htaccess in your root directory, the test.cgi would open when people visit your site.
DirectoryIndex ./cgi-bin/test.cgi index.html index.htm

If you add the above DirectoryIndex argument to your .htaccess in your root directory AND you want it to apply to ALL of your sub-directories, then you will need to delete the leading "."
Example:
DirectoryIndex /cgi-bin/test.cgi index.html index.htm


9. Pending

Pending


10. Pending

Pending


11. What other resources can I look to for further CGI help?

The following is a list of websites and newsgroups that you can visit for additional help.

comp.lang.perl.misc
comp.infosystems.www.authoring.cgi
http://www.perl.com
http://www.cgi-resources.com
http://www.worldwidemart.com/scripts
CGI FAQ




HOME >Homepage Setup >FAQ >Feedback

>OS >Windows 3.1 >Windows 95 >Windows 98 >Windows NT >Macintosh

>SUPPORT >FTP Support >E-mail Support >Modem Support