Support Documents

* Bananic provides CGI for all web hosting accounts.

  • CGI-bin Applications
  • Where to Put CGI-bin Scripts
  • Paths to Mail, Date, Perl, etc.
  • Troubleshooting

    Back to Support menu
     
  • CGI-bin Applications

    CGI is short for "Common Gateway Interface," a name meaning computer programs running on the web server that can be invoked from a web page at the browser. The "bin" part alludes to the binary executables that result from compiled or assembled programs. It is a bit misleading because cgi's can also be Unix shell scripts or interpreted languages like Perl.

    For those who are not familiar with CGI scripting, you may want to read on the subject or find information on the Internet about CGI scripting. There are many good resources for CGI scripts found on the web. Basic scripts can be found at Matt's Script Archive; http://www.worldwidemart.com/scripts/ . You'll find many scripts free of charge and with detailed configuration information. Another excellent resource is The CGI Resource Index found at http://www.cgi-perl.com/  -- if you are not an expert, look for scripts that are very well documented and come with step-by-step instructions.

    Note: CGI scripts need to be uploaded in ASCII or text format. This is very important or your script may not work.

    Back to Top

  • Where to Put CGI-bin Scripts

    You can put your cgi-scripts anywhere throughout your server.  However, we would recommend creating a cgi-bin folder and putting them in there.

    Back to Top

  • Paths to Mail, Date, Perl, etc.

    Here are your paths to the common server resources that CGI scripts often require:

    Sendmail: /usr/sbin/sendmail

    Perl5: /usr/bin/perl
    Tcl : /usr/bin/tclsh

    Date: /bin/date

    CGI path: "/users/web/<yourlogin>/web/cgi-bin".
    Note: this path is seen as "/cgi-bin" via ftp.

    Root web path: "/users/web/<yourlogin>/web"
    (your root web directory of your account)

    Back to Top

  • Troubleshooting

    Below are solutions to some of the more common CGI script problems, in question and answer format. You will find a list of proper permission settings for the scripts we provide at the end.

    Q) I am being told "File Not Found," or "No Such File or Directory."

    A) Upload your Perl or CGI script in ASCII mode using FTP, not binary mode.

    Q) When I activate my CGI program, I get back a page that says "Internal Server Error. The server encountered an internal error or mis-configuration and was unable to complete your request."

    A) This is generally caused by a problem within the script or file permission errors. To locate the problem, you will want to look at the error log and the execution log for your website.

    As a general guideline, you may test to see if your script by logging in via SSH/Telnet and test your script in local mode to get a better idea of what the problem is. To do this, go into the directory in which your script is located, then execute the script. To execute the script, you can do it by typing "./myscript.pl" (replace myscript.pl with the name of your script file). If the script executes, that means that the first line of the script refers to the correct script interpreter path (eg. /usr/bin/perl).

    This is useful to see if there's any error IN your script and is also useful to test if your "calling line" (the first line of the script) is okay, i.e. if you entered the right location of Perl.

    Q) When I test my Perl script in local mode (by Telnet), I have the following error: "Literal @domain now requires a back slash at myscript.pl line 3, within string. Execution of myscript.pl aborted due to compilation errors."

    A) This is caused by a misinterpretation by Perl. You see, the "@" sign has a special meaning in Perl; it identifies an array (a table of elements). Since it cannot find the array named domain, it generates an error. You should place a back slash (\) before the "@" (eg. "\@") symbol to tell Perl to see it as a regular symbol, as in an email address.

    Q) I am getting the message "POST not implemented."

    A) A possibility is that you are pointing to a cgi-bin script that you have not put in your cgi-bin directory. In general, this message really means that the web server is not recognizing the cgi-bin script you are calling as a program. The webserver only recognises the file as a regular text file. If you would like to place CGI files outside the cgi-bin directory, the CGI script files needs to have the .cgi extension.

    Q) It's saying permission denied.

    A) This error message means your CGI script file permission is not set correctly. To set the file permissions using FTP, please see Setting Permissions.

    Back to Top

    Back to Support menu