|
Advanced users may want to run their own CGI scripts on their website. This document describes how to set up such functionality.
Initial One-time Setup. All CGI scripts need to be placed in a directory named "cgi-bin" within your network drive. If you do not already have this directory, you will have to create it. Note that the cgi-bin directory, like pub_html, should be located at the top-most level of your network drive (i.e. "J:\cgi-bin\" for windows users). The directory should be given a permissions setting of 711. If you are unfamiliar with how to set permissions, please see the Personal Website Permissions howto.
Then, for each personal CGI script:
- Place your CGI script (e.g. myscript.pl) in your cgi-bin directory (see "Initial One-time Setup" above).
- Give your CGI script executable permissions. Permissions of 700 are recommended.
- Test your CGI using the following URL, substituting "username" and "myscript.pl" with your username and CGI filename, as appropriate:
http://www.sju.edu/cgi-bin/cgiwrap/username/myscript.pl
Please note that your CGIs will be executed as yourself which means you should be extra careful about the security of your script. Your script will have all the permissions as you to manipulate/create/delete all the files on your network drive. Thus, you should feel comfortable that your CGI is not vulnerable to potential mis-use. Remember, these CGIs are on a public webserver, and attackers may try to get your scripts to do things they were never intended to do. If you are unsure about your script's security, it is recommended you ask a knowledgeable friend for advice.
Potential Errors. Once you have completed the above setup and gone to the appropriate URL, you may still have problems. Here is a short list of the most common:
Typical cgiwrap Errors
Error |
Reason / Remedy |
| Error 404 - File Not Found |
You have not typed the URL properly. The format is: http://www.sju.edu/cgi-bin/cgiwrap/username/scriptname |
| CGIWrap Error: Script dir not found! |
This message comes from the cgiwrap "wrapper," which is alerting you that it cannot find your "cgi-bin" directory. This is usually because your cgi-bin directory is not in the right place. Remember, the cgi-bin directory should be located at the top of your network drive ("J:\cgi-bin" in Windows terms, "~/cgi-bin" in Unix talk). |
| CGIWrap Error: Script File Not Found! |
Permissions on cgi-bin directory incorrect. A permissions setting of 711 on this directory is recommended. For help setting permissions, please see the Personal Website Permissions howto.
and/or
The CGI script does not exist. Perhaps you have typed the name of the CGI script incorrectly or have not yet saved your script into the cgi-bin directory. Remember, capitalization does matter, just like with webpages. So for example, "Myscript" and "MyScript" are treated as different filenames. |
| CGIWrap Error: Execution of this script not permitted |
CGI script has insufficient permissions to run. Permissions of 700 are recommended. For help setting permissions, please see the Personal Website Permissions howto.
|
| CGIWrap Error: Script Execution Failed |
This message usually indicates there is a problem with the script itself. Often this indicates either that the #! line of the script is incorrect, or the script was uploaded in binary mode instead of ASCII mode. This is typically a problem if the script was edited or uploaded from a DOS/Windows/Macintosh computer. Try saving the file in "Unix format."
|
|