AAPT Home > Support Information > Web Hosting > CGI
CGI (Common Gateway Interface) provides an interface between a web browser and the web server. As an example, when a vistor to your site fills in a form, her web browser will use CGI to pass the values from that form to a script (or program) in your cgi-bin directory. A script that accepts and processes such values is called a CGI script.
You may use CGI programs written in scripting languages such as perl and Unix shell programs on your AAPT Web site. All CGI programs must be saved in your cgi-bin directory.
Please be aware that, for security and to protect system resources, your own binary files are not permitted and AAPT reserves the right to remove any binary file without notice.
CGI scripts can be used to process data in a wide range of ways. A very common use of CGI is to have a script that will email you the contents of a form submission. AAPT provides a customisable script for this purpose; see the page on superForm.cgi for more information. If you wish to use your own form to email script, there is some information that may help if you encounter problems.
CGI scripts are wholly your responsibility. AAPT Support cannot assist with diagnosing problems and debugging your CGI scripts. If you encounter problems, you may find the following tips useful.
Ensure that permissions are correctly set for the scripts. The script must must read and execute permissions enabled. If you have logged in via telnet or SSH, you can use "chmod 755 foo.cgi" to set permissions. Some FTP programs also allow you to set permissions.
If the script is written in Perl, ensure that the first line contains the correct path to Perl: #!/opt/local/bin/perl
If your scripts sends content (eg. HTML) back to the browser, ensure it sends a Content-type header first. Eg. "print Content-type: text/html\n\n"
Text based scripts (eg. perl, bash, python) should be uploaded using your FTP program's ASCII mode rather than binary mode. End of line characters from some non-Unix operating systems can cause a script to fail.
| Copyright © AAPT Limited |
|