This is an image that says University of Nevada, Las Vegas

CGI Access

In order to allow users to write/install cgi scripts, CGIWRAP has been installed on the Faculty Web Server (faculty.unlv.edu). CGIWRAP protects the web server by running the cgi script as the owner of the script (thus limiting any damage done by the script to that account).

Setting Up Your Script

Once you have been added to the access list, place your cgi script in the directory cgi-bin located in your HOME directory (the directory your www link is in).

Before trying to test the script, don’t forget to make the script executable! Many FTP programs allow you to set your file permissions. If you’re not sure how to do this, check your FTP program’s menu options or refer to your program’s help files for details. Another method is to log in via an SSH program. (NOTE: You’ll need to know some Basic UNIX Commands in order to use an SSH program.) After logging into SSH, change into the directory where the script is located. Set the file permissions by issuing the following command at the system prompt:  chmod 755

Installing scripts

Perl

To install a Perl script, follow these guidelines:

  1. The following line should appear as the first line of your script:
    #!/usr/local/bin/perl
  2. Your script must be placed in the cgi-bin directory.
  3. The file permissions must be set to executable.

PHP

If you are setting up a PHP script, please note that PHP works much the same as Perl on the Faculty Web Server. In order for your script to work, you must observe the following guidelines:

  1. The first line of your script must look like this:
    #!/usr/local/bin/php
  2. Your script must be placed in the cgi-bin directory.
  3. The file permissions must be set to executable.

Viewing Your Script

To see your script in action on the Web, use the following URL:

http://faculty.unlv.edu/cgiwrap/yourloginname/scriptname

If a Web page is returned that says “CGIWrap Error: Execution of this script not permitted,” it means you forgot to make your script executable.

Debugging

To assist in debugging your cgi script, use the URL listed below (notice the “d” for “debug” appended to “cgiwrap”). This will allow you to see any errors output by the program during the run.

http://faculty.unlv.edu/cgiwrapd/yourloginname/scriptname

Perl

A useful way to find errors in Perl scripts is to run them at the command line in SSH. To access the Perl debugger, type the following command at the system prompt:

perl -d scriptname

Once in the debugger, type h for a list of commands.

Requesting Assistance

At the present time, we are unable to provide help debugging CGI scripts. Problems with access to the CGI facility can be directed to the OIT Help Desk.

Also check out: