From SonicWiki
Jump to: navigation, search

Please note that for most modern web applications, the CGI-bin is not necessary; the shared web environment executes Perl and PHP scripts using the permissions of the web directory's owner, not the Apache server itself.

What is a CGI?

The Common Gateway Interface (CGI) is a mechanism for sending information from an end-user's web browser to a program on the web server. CGI also allows for the program's output going back to the end-user's web browser for display. Common usage for the term "CGI" is in reference to a program that takes input from a web browser and does something with it. Common uses for CGIs include web guestbooks, search engines, and shopping cart software.

Commonly Used Languages

There are a number of languages that can be used to write a CGI. The following are some of the more popular languages that our web servers support.


Perl is a widespread scripting language that has rather firmly entrenched itself into the internet. Our web servers run both Perl 5.6.1 and Perl 5.10.1.
Perl 5.6.1 is located at /usr/bin/perl
Perl 5.10.1 is located at /usr/bin/perl5.10.1


PHP: Hypertext Preprocessor (PHP) is used as an alternative to Microsoft's Active Server Pages (ASP) technology. Our webservers use PHP version 4 (view full info) with the interpreter located at /usr/bin/php PHP 5 is available (view full info), though it is not used as the default interpreter. Please see our PHP 5 document for more information.


Python is a strongly object-oriented programming language that is becoming increasingly popular with web programmers. Our webservers use Python version 2.3.4 with the interpreter located at /usr/bin/python and Python version 2.6.5 with the interpreter located at /usr/bin/python2.6


One of the most broadly-used programming languages of all time, programs written in C or C are most often compiled into self-sufficient executable files.

Unsupported development mechanisms

The webservers do not support CGI-style programs written in the following formats:

    • Microsoft Active Server Pages (ASP)
    • Java Server Page (JSP)
    • Cold Fusion

Location of commonly used utilities

Date is located at /usr/bin/date
Sendmail is located at /usr/sbin/sendmail
Convert is located at /usr/bin/convert

What does Permission Denied mean?

Permission Denied is an error that is triggered when a program tries to do something it is not allowed to, or when a web browser requests a file that it is not allowed to use If you are getting this message on a page or script that you own, then you probably need to change the permissions on that file. Just login to your shell account and do the following:

    • type: cd /path/to/file/
    • then type: chmod 755 filename
    • then: exit to leave the shell.

Most Mac and Windows FTP programs will allow you to change file modes (permissions) as well, so shell access is not strictly required to modify permissions. Advanced information on Modes.

What does Malformed Header mean?

A malformed header is a general error that means that your CGI did not execute properly. This can be caused by an improper type declaration in your program's output, or even by a syntax error in the program itself. Missing semicolons and incorrectly uploaded files are common culprits. Double-check the source code for errors and try again.

Where can I find the error logs for my CGI?

The error logs for each of our web servers are located at /var/log/custweb/error.log. Inspecting the error logs can be very helpful in tracking down the causes of CGI problems in general.

Where can CGIs be run from?

/home/WWW_pages/username/ This is your default web directory, where your HTML and image files are likely to be located.

What will the URI for my CGI be?

Files in your default web directory will be accessible on the web at

CGI-bin and virtual hosting

For virtual domain based hosting, any requests for "/cgi-bin" or "/cgi" subdirectory are mapped to your user's cgi-bin directoy.

How do I get CGI help?

You can start by posting your questions to the Hosting Forum.