CISE Help & Resources

CGIwrap

When to use cgiwrap

The cgiwrap method has the advantage of being easier to debug (through the use of cgiwrapd described below). This alone makes cgiwrap the better method in most cases.

If the CGI script is not going to be run from a users' home directory (i.e. it is in class or research space), or if the script will not be placed in a cgi-bin directory, the cgiwrap will not work and the suexec method must be used.

How to use cgiwrap

  1. Make a directory called cgi-bin under your public_html directory, and set its permissions to 755:
    mkdir ~/public_html/cgi-bin
    chmod 755 ~/public_html/cgi-bin
    
  2. Put all your CGI scripts in your cgi-bin directory (you can even use subdirectories if you wish, but make sure their permissions are set to 755).
  3. Use one of the following URLs to run your script (they are all equivalent):
    http://www-pub.cise.ufl.edu/cgi-bin/cgiwrap/?user=foo&script=bar
    http://www-pub.cise.ufl.edu/cgi-bin/cgiwrap/foo/bar
    http://www-pub.cise.ufl.edu/cgi-bin/cgiwrap/~foo/bar
    
    where foo is your username and bar is the name of your script.
  4. CGI scripts must emit the appropriate header(s). One of the most common bugs is to forget the Content-type: text/html header (or whatever type is appropriate). Scripts that do not sent this header will cause an Internal Server Error, as the server has no idea what it's to send. Also, remember a blank line after your headers. Better yet, use the CGI perl module, which takes care of most of this for you.
  5. CGI scripts are notoriously difficult to debug, but cgiwrap can provide you with useful information if your script isn't working properly. Simply substitute cgiwrapd for cgiwrap in your URL:
    http://www-pub.cise.ufl.edu/cgi-bin/cgiwrapd/?user=foo&script=bar
    http://www-pub.cise.ufl.edu/cgi-bin/cgiwrapd/foo/bar
    http://www-pub.cise.ufl.edu/cgi-bin/cgiwrapd/~foo/bar
    
    where foo is your username and bar is the name of your script. Also, you can directly log into www-pub.cise.ufl.edu to clean up any stray processes, attach a remote debugger (be careful of server timeouts), or any number of things.
  6. Once you're sure your script is secure, and that it isn't going to leave around CPU-eating children, you can refer to it directly through www.cise.ufl.edu rather than www-pub.cise.ufl.edu. Keep in mind that you have no direct shell access to www.cise.ufl.edu, so you may wish to keep it on www-pub permanently.

Info for Students

Info for Faculty & Staff

Industrial Advisory Board