Indiana University
  •  
  •  
  •  

Setting up CGI scripts

To run CGI scripts from your account on Webserve:

  1. Name your script so that it ends with a .cgi or a .pl extension. Scripts without one of these extensions will not run on Webserve.

  2. Put the script in your www directory or any subdirectory of your www directory.

  3. Set the permissions of the script to read, write, and execute for the owner only. To do this, move to the directory where your script is stored and, at the command prompt, enter: chmod 700 scriptname

    Replace scriptname with the name of your script. For more information on the chmod command, see In Unix, how do I change the permissions for a file?

  4. Make a link to your CGI script from a web page or using the action attribute in the <form> tag of a form that submits information to your CGI script. As with your other files on the server, you don't need to include the www directory within the URL for your script. The URL of your script will be in the following form: http://www.iupui.edu/~netid/subdirectory/scriptname

    Replace iupui with your campus designation, if necessary. Replace netid with the account's Network ID username, and if your script is in a subdirectory of www, replace subdirectory with the name of the subdirectory of your script. Replace scriptname with the name of your script.

  5. Test your script to make sure it is working properly.

The information above comes from the IU Webmaster's Executing CGI Scripts page.

For useful utilities and guides for creating web pages on Webserve, see the IU Webmaster's Tools for IU Information Providers page.