Free Hosting > Support > Creating a Website using CGI Scripts
Creating a Website using CGI Scripts
What is CGI Scripting ?
CGI stands for Common Gateway Interface. It is a set of protocols (or rules) which determines the basic definitions of how a program should parse these submitted forms. Forms are blank fields such as check boxes, input boxes and radio buttons that allow browsers to make selections. In order to process these selections, the forms require submitting and is then parsed by programs on the server.
Why isn't my CGI script working ?
Here are some common problems encountered with CGI scripts:
- Script was uploaded in BINARY mode instead of ASCII mode. Solution: Upload the file in ASCII transfer mode using your FTP program. The script must actually upload as a 'text' file. If your FTP program automatically puts a ".txt" notation at the end of the script, then you will be required to delete the ".txt" from the file name after you upload it onto the server.
- The directory your CGI or Perl script resides in does not have the proper permissions. The directory permissions should be set to 755 or chmod 755 cgi
- CGI's must have permissions of "755" or they won't execute. (chmod 755 *.cgi)
How do I implement customized scripts ?
Most web hosting servers have the capability to run CGI scripts based on Perl. Make sure that your hosting company supports CGI's and then check to see if a directory exists. Perl is typically the language of choice as it is a internationally recognized standard as it is well suited for CGI. Also, Perl code does not require manual compilations whereas C/C++ code must be compiled your web hosts servers prior to use.
If you require a custom CGI script then upload it to your personal cgi directory. Here are some helpful tips to follow when installing Perl scripts:
- Upload tos your cgi directory and ensure proper file permission settings
- Upload in ASCII transfer mode (NOT BINARY mode)
- The first line of each script must read: #!/usr/bin/perl
- Reference the script using /cgi (NOT /cgi-bin)
If a script calls another file within your account, but the script does NOT require a URL, you need to use the system path.
/home/[userid]/HTML/... - if the file is in your web site root directory
/home/[userid]/HTML/cgi/... - if the file is in your cgi directory
Substitute the path to the file beginning with your userID. Your userID is the directory name of your account.
Where do I put my CGI scripts ?
Place your CGI scripts (or programs) in your HTML/cgi/ directory. The scripts must have the .cgi extension. We can allow scripts to run in alternate locations. Please contact NetNation Support for any special requests. For example, if you had placed a cgi script called surprise.cgi in the directory HTML/cgi/, you access it via: http://www.your_domain.com/cgi/surprise.cgi
|