Print Page Print Page | Email Page Contact Us | Bookmark Page   
I need help with...

How to use this site

Setup & Troubleshoot
Dialup Connections
DSL Connections
VPN Connections
Mail & News
Web Browsers
Personal Homepage
Corporate Webhosting

Expedient Services
Away from home...
   Nation-wide Access
   Global Access
   Webmail
Spam Filter

General Information
Expedient.com
Network Status
Local Access Numbers
Servers and Settings
Min System Requirements
Supported Software
Spam & Security
Virus Protection
Tech Tips & Support Links
Virtual Applications

Speed Test


CGI Frequently Asked Questions

  1. What is CGI?
  2. What version of Perl is installed on the server?
  3. How do I configure the Counter (Count.cgi) script?
  4. Are there CGI resource limits on Expedient's servers?
  5. Can I run CGI scripts anywhere on my virtual server?
  6. What file extensions should I use for my cgi-scripts?
  7. What paths should be used for Perl, sendmail, etc?
  8. What permissions do I need to use on my CGI scripts?
  9. How do I set permissions?
  10. Why do I get 500 Internal Server Error when I try to run my CGI scripts?
  11. I get a Document Contained No Data in the browser
  12. I am getting a 510 Method not Implemented Error
  13. I am getting a POST not Implemented Error
  14. I am getting a 401 File not Found Error
  15. I am getting a 403 Forbidden Error
  16. Where can I find CGI scripts and documentation?
CGI Troubleshooting Quick Reference
  • Path to perl: #!/usr/local/bin/perl
  • Uploaded in ascii vs binary?
  • If called, correct extension? .pl or .cgi?
  • Path to sendmail correct in cgi script and html?
  • Permissions correct? chmod 755
  • Scripts in cgi-bin?
  • Used a basic text editor to edit?



    1. What is CGI?

      Abbreviation of Common Gateway Interface, a CGI program is any program designed to accept and return data that conforms to the CGI specification. CGI programs are the most common way for Web servers to interact dynamically with users.

      Top


    2. What version of Perl is installed on the server?

      We are currently running Perl version 5.6.1

      Top


    3. How do I configure the Count.cgi script?

      Information on how to call the Count.cgi script and configuring the counter is available on www.muquit.com.

      Top


    4. Are there CGI resource limits on Expedient's servers?

      Expedient has set CGI resource limits as follows:
      • Maximum execution time (CPU run time): 30 seconds
      • Memory limit per process: 8MB

      These limits are necessary to prevent run-away processes and overuse of resources.

      Top


    5. Can I run CGI scripts anywhere on my virtual server?

      CGI scripts need to be stored in the cgi-bin directory which is located in your home directory.

      Top


    6. What file extensions should I use for my cgi-scripts?

      CGI scripts should use the .cgi or .pl file extension.

      Top


    7. What paths should be used for Perl, sendmail, etc?

      • Perl: /usr/local/bin/perl
      • Sendmail: /usr/lib/sendmail
      • FormMail Action: http://wunpgh01.crane.sgi.net/cgi-bin/FormMail.pl


      Top


    8. What permissions do I need to use on my CGI scripts?

      To avoid problems, you should set your CGI script permissions to 755. This allows the owner can read-write-execute permissions, and group/others can read-execute permissions.

      • Read permission (r) lets you look at a file or directory. You can use cat or a text editor to see what is in a file that has read permission; you can also copy this file. Read permission for a directory lets you list the directory's contents.
      • Write permission (w) lets you make changes to a file. Even if you can write (change) a file, you can't necessarily delete or rename it; for these actions you must be able to write in the directory in which the file resides. If you have write permission in a directory, you can create and delete files in that directory.
      • Execute permission (x) lets you run the program contained in the file. The program can be a real program or a shell script. (If the file doesn't contain a program, execute permission doesn't do much good and can provoke the shell to complain bitterly as it tries to make sense of the file)


      Top


    9. How do I set permissions?

      Setting your CGI file permissions will depend on your FTP client or whether you use shell (ssh) access. Consult your FTP client's Help files for further information and instructions.

      When using Set permission by....
      WS FTP, CuteFTP
      Windows
      Select the file, then click the right mouse button and select chmod from the popup menu. The Remote File Permissions dialog box appears. Select the proper options or type in the number and click OK.
      WS FTP LE shown
      Fetch
      Macintosh
      Fetch allows simple point-and-click management of remote file permissions via the site chmod and site umask commands. Highlight the file. Click the Remote menu and select Set Permissions.
      Unix chmod - change the permissions mode of a file:
      chmod [ -fR ] <absolute-mode> file...
      chmod [ -fR ] <symbolic-mode-list> file...
      Example: Allow owner to r/w/x, and group and others to r/x but not w: example% chmod 755 file where [file] is the name of the file or directory you wish to set permissions.


      Top


    10. Why do I get 500 Internal Server Error when I try to run my CGI scripts?

      500 Internal Server errors occur when the webserver is able to access the file, but it cannot execute it, or it does not understand the output.

      One of the most common reasons for this error is incorrect file permissions. Cgi-bin scripts and executables must have the proper permissions or an internal server error will occur. The directory (and all the CGI scripts within it) must NOT be world writable. This is the most common error. See How do I set permissions? for information to set the correct file permissions.

      This error can also occur if you have uploaded the CGI script as binary instead of ASCII. Most FTP clients will give you the option to upload in either binary or ASCII mode. Consult your FTP client's Help files if for more information on how to change the upload method.

      Some editors add extraneous characters that will cause a problem with running the script. Don't use Word, WordPerfect, or any other 'word processing' program. Use a basic text editor like Notepad, WordPad, Pico, SimpleText or a similar program. Open the script in a text editor and try re-saving it to your hard drive before FTPing it.

      All Perl scripts must start with an identifier, called the "shebang", which tells the server the path to find the Perl interpreter so that it can run the program. This is usually the first line of the script and should look like #!/usr/local/bin/perl. Perl can be found on most Expedient servers in /usr/local/bin/perl. If you have shell access to your webspace, you can check the location of perl with the command: which perl

      Make sure ACTION="" of script on the web page is pointing to the correct CGI program and has the correct path.

      Check the syntax of the script. Every statement in a Perl script must end with a semicolon (;) except conditionals and subroutines; these are enclosed in brackets. Perl variables must start with a $, % or @; be sure a symbol was not omitted from a variable name. Check to be sure that quotes and apostrophes are present on each end of strings as appropriate. Be sure that escape characters - in Perl, the backslash (\) are included in a quoted string where needed with a quotation mark or apostrophe if needed.

      If everything above checks out okay, chances are there may be an error within the script itself. If you downloaded the script from an online archive, double check any changes you have made. Most downloaded scripts have a readme file or comments added to the script to help you configure it properly.

      Top


    11. I get a "Document Contained No Data" in the browser

      This appears when the script does not return any information to the browser. Often it happens when the script tries to access a nonexistent file and then return information from that file. Check that the filepaths are correct.

      Top


    12. I am getting a 501 Method not Implemented error

      This occurs when CGI scripts are not permitted to be executed in the specified directory. If the files are not in the cgi-bin, the server will not allow the POST method to these fiels and will not execute the scripts. Check that the scripts are in the cgi-bin directory. If this does not resolve the problem, try changing from a .pl extension to .cgi.

      Top


    13. I am getting a POST not Implemented Error

      This message indicates that the server is 'identifying' the script, not as a program that is being called, but as a regular text file. The problem may be that the path is pointing to a script that is not in your /cgi-bin directory. Be sure the script is in the cgi-bin directory and that the paths are correct.

      Top


    14. I am getting a 401 File not Found Error

      Make sure that all of the URLS are correct in the scripts and make sure that when the necessary portions of certain URLS are combined they form complete URLS.

      Top


    15. I am getting a 403 Forbidden Error

      The server was instructed not to serve the file. This can be an htaccess directive or a directory that is readable by the server. Check the permissions of the directories.

      Top


    16. Where can I find CGI scripts and documentation?



      Top


     
    Was this information helpful?
    not at all very helpful!

     

    copyright © 2004  Expedient Holdings USA, LLC