Using CGI Applications


Here is a link for CGI Scripts - http://www.worldwidemart.com/scripts/


For all of you that need to create and run cgi-bin scripts and programs, a new method (cgiwrap) allows you to do that. For those of you that already have cgi-bin scripts, nothing will changed but you may want to consider switching to this new method. Following are the set up instructions.

  1. Create a subdirectory called cgi-bin in your public_html directory

  2. Change the permissions for this directory to drwx------ (700).

    If you are not sure how to change permissions read these instructions for Fetch, or these instructions for WS-FTP. If you are not using either of these two applications, please refer to the help documentation for that application.

  3. Install your CGI script in the cgi-bin directory and give it executable permissions of -rwx------ (700). Make sure that you transfer your script files in ASCII mode.

    Ensure that the perl path in your script is one of the following, depending on the version you need:

    /usr/local/bin/perl -or-
    /usr/local/bin/perl5.002

    If you need "sendmail", use the following path:

    /usr/lib/sendmail

  4. Now you are ready to use your CGI script. To access it, use the following URL:

    http://server/cgi-bin/cgiwrap/USERID/SCRIPTNAME?arg1&arg2&arg3.....

    where server is the name of the www server, USERID is your login name, SCRIPTNAME is your CGI script name, and arg1, arg2, arg3.... are the arguments, if any, to your script.

    Use the following URL for debugging:

    http://server/cgi-bin/cgiwrapd/USERID/SCRIPTNAME?arg1&arg2&arg3.....

    where USERID is your loginname, SCRIPTNAME is your CGI script name, and arg1, arg2, arg3.... are the arguments, if any, to your script.

  5. If your script is giving you error messages, you can run the following command (on the server) to view the HTTPD error log:

    tail -10 /SERVICES/Web/server/logs/error_log

Note: When you run a CGI script from your account using CGIWrap, the script will run with you as the process owner. This means that the script will have the same permissions that you do and will be able to read and write to files that you own as long as they have at least 700 permissions. CGI scripts that do not run with CGIWrap run as httpd (the Web server) and cannot write to files that you own unless the files have 777 permissions. Since 777 permissions are inherently risky, using CGIWrap provides a significant security improvement.