Standard Edition: CGI Scripts
From Campus Web Server Help
Contents |
Overview
CGI scripts provide a powerful facility for interactivity in your website. They are programs that can handle input from forms, output system properties such as the current time, store data to files, send email, and much more. PHP is handled differntly, using FastCGI. Unlike CGI, such scripts can be executed from within your public_html directory directly. Most CGI scripts on our server are probably written in perl or python, whose current version you'll find on the here.
Security and File Permissions
Please use safe coding practices to help everyone avoid disruption of service. All scripts will be run as your primary account username. Thus, you can and set file permissions more strictly than you might if you were hosting with a typical hosting service. By setting proper permissions, you can have a much greater assurance that other users' cannot peek at your files; also, if their code is exploited, your files will likely remain safe.
See Also
Wikipedia's Filesystem Permissions article
How To Make CGI Scripts Work on Your Site
Location and Permissions
Your CGI scripts (bash, perl, python, etc) should reside in cgi-bin. When file permissions are set properly, the permissions (octal 700) will look like this:
-rwx------
Ensure that the first line of the script refers to the correct interpreter. For example:
#!/usr/bin/perl
or
#!/usr/bin/python
Referring To The Scripts In Your HTML
In your HTML, you will use something like this:
<form action="/cgi-bin/process.pl">
