header.inc.php
  Welcome to Real Web Host ! | REALWEBHOST.NET | AFFORDABLE HOSTING SOLUTIONS     
  Home Sitemap Contact Us
Domain Registration From $12.50 Per Year
Home Shared Hosting Dedicated Hosting Resellers VPS Support
 The Best Web Hosting Deal Special
  
Upgrade Your Hosting Account Existing Hosting Clients Upgrade Your Hosting Today!
 
Using
 

Using and Troubleshooting CGI Scripts

All Unix web hosting accounts that support a domain name will allow you to install and use your own CGI scripts.

Keep in mind that using CGI scripts and CGI programming are a lot more involved than HTML, and require a basic understanding of file permissions, directory structure, Unix commands and programming in languages like Perl or C. If you are new to web development, or do not have these skills, we suggest using some of the pre-installed CGI scripts that are available.

CGI Script Usage

Here are some guidelines and tips for using CGI scripts with your Unix web hosting account.
 

bullet The name give to your CGI scripts must have the extension .cgi (for example, search.cgi, mail.cgi, etc). The extension .cgi tells the server that the file should be processed as a CGI script. If the file extension used for your script is .pl, you will need to rename your script before it will work.
bullet CGI scripts can be placed in any sub-directory within your public_html directory. They do not need to be placed in a directory named cgi-bin. If the directions for your CGI script say to place the script in your cgi-bin directory, you can place the script in any sub-directory within your public_html.

bullet Do not create a directory in your public_html named cgi-bin. The cgi-bin directory is a special system directory that contains pre-installed CGI scripts, and cannot be used as a sub-directory to store your own CGI scripts. If you want to make a directory for your CGI scripts, we suggest using the name cgibin.

bullet Make sure that you set the proper permissions for your scripts. Users must be able to read and execute your script. This can be done by telnet using the command "chmod 755 script.cgi", or by FTP (if your FTP software supports this).
bullet If your script is written in Perl, the first line must be configured to tell the script where Perl is located. The first line of your script should read:

#!/usr/bin/perl

bullet The location of the sendmail program on the server is:

/usr/lib/sendmail
bullet Usually, CGI scripts need to have some configuration done that includes the path to your directory. To configure your CGI script, you will need to determine your home directory.

bullet If you need to edit a CGI script, you must use a simple text editor (like Notepad or SimpleText). You cannot use a program like Microsoft Word or WordPerfect.

bullet Never upload CGI scripts in BINARY transfer mode - always upload CGI scripts in ASCII transfer mode. Even if your FTP software has an "automatic" setting, it's best to force it to upload in ASCII for CGI scripts. When a CGI script is uploaded using the wrong transfer mode, you will get a "500 Server Error".
bullet If your script needs to write to certain directories or files, make sure that the permissions are set to allow this. Normally, a CGI script would include directions telling you what the permissions should be set to. A Unix / CGI Script Permissions Guide is available if you need more information.

bullet If you need to run CGI scripts as your own username, you can use a CGI wrapper to run your scripts. The wrapper installed for you is called cgiwrap.

CGI Troubleshooting

When installing a CGI script, there are usually problems. Each CGI script is different and requires different settings, and even the pros have problems.

By far, the most common error you will get when trying to set up a CGI script is a "500 Server Error". This error means that there is something wrong with the internal workings of your script. Here are the most common problems/solutions:

bullet Upload your script again. If the script was uploaded to the server using BINARY mode instead of ASCII mode there will be extra characters in the script, and a 500 server error will result.

bullet Check the permissions on your script. CGI script permissions need to be set to 755 (more information on Unix / CGI Script Permissions is available).

bullet If your script needs to read or write to other files on the server, check to ensure that the correct permissions are set on those files.
bullet Try running your script in from telnet. If there is an actual error in the script, this will tell you what line the error is on and what the error is. To do this, log in using telnet, go to the directory containing your script, and enter:

./scriptname.cgi
bullet If you want to see the web server error logs on the, log in using telnet, run your script and then enter:

tail -50 /usr/local/apache/logs/error_log

This will give you the last 50 lines of the error_log, which may contain errors from your script.
bullet Check to make sure that there are no blank lines at the TOP of your script.

 

 

 
     
Untitled Document
Login to your hosting cpanel to view the latest server status, billing information, site and domain status, and much more. You will also have the option of using our support ticket system, or use our hosting community forums.
 
Untitled Document
 
Data Center Cpanel Website Transfers Hosting Knowledgebase
Web Hosting Privacy Policy Web Hosting Option Add On's
Hosting Merchant Accounts
Customer Hosting Websites Web Hosting Site Map Pre-Sales Hosting Questions
Web Hosting Web Site Builder Web Hosting Forums
Hosting Affiliate Program
Web Hosting Specials Web Hosting Features    
Web Hosting Packages    
Web Hosting Reviews
 
HOME | SHARED HOSTING | DEDICATED HOSTING | RESELLERS | SUPPORT | CONTACT

About | Partners | Reviews | Rules | Sitemap | Beginners
Developed by Vtrio Solutions Pvt Ltd   © Copyright 1997-2007, REAL WEB HOST. All Rights Reserved. http://www.webhosting-rated.com/index.php