fsu seal Florida State University
Systems - Webmail - Web Support - UCS Home


 

UCS > Online help

Info for New Students

Secure Shell Help
Setup SSH


eMail

Listserve

Info for New Web Sites
Building a site
Intro to FSU's web
Publishing to the web

UNIX Operating System
Lynx
:Text-only Webbrowser


FSU Computing

Policies
Data Management
and Security
Guide to Computing





University Computing Services

Using CGI Programs on UCS Web Servers

For security reasons, WWWpage developers on garnet.acns.fsu.edu , mailer.fsu.edu , and www.fsu.edu are not permitted to place programs in the main Web CGI directory, nor will the HTTP server recognize programs in user-owned cgi-bin directories.

However, UCS has installed a CGI wrapper program on the Web-servers that provides extra security and allows CGI applications to be started up indirectly. The wrapper ensures that the executing program runs under the ownership of the program owner, rather than the Web owner.


To create your own CGI programs, you must:

Create a subdirectory called cgi-bin directly under public_html. Any programs to be executed from your Web pages should be placed there.

Set the permissions for cgi-bin and all scripts in that directory to owner read/write/execute. Permissions for other users will not be required.

To run the program, you need to set a link that invokes cgiwrap and tells it what to to start up. The link should be of the form

http://mailer.fsu.edu/cgi-bin/cgiwrap?user=[your_username]&script=[your_program]

or

http://mailer.fsu.edu/cgi-bin/cgiwrap/~[your_username]/[your_program]

where [your_login] is your Mailer user name and [your_program] is the name of the program in your public_html/cgi-bin directory. Do not include the brackets. The latter form of the URL will permit the use of query strings (appended to the program name with '?'), while the fisrt form will not.

For example, if you are smith936, you might set up program named get-form.pl with the action URL:

<form method="POST" action="http://mailer.fsu.edu/cgi-bin/cgiwrap?user=smith936&script=get-form.pl">

or

<form method="POST" action="http://mailer.fsu.edu/cgi-bin/cgiwrap/~smith936/get-form.pl">

Substitute garnet.acns.fsu.edu for mailer.fsu.edu if your account is on Garnet. Departmental sites can use http://www.fsu.edu/cgi-bin/cgiwrap.

If you wish to obtain extra debugging information, substitute cgiwrapd for cgiwrap.

** Check your header information, it should be as follows for perl cgi:

On www.fsu.edu  use:   #!/usr/bin/perl

On mailer.fsu.edu   use:   #!/usr/local/bin/perl


Troubleshooting:
CGIwrap Error: System Error: execv() failed
Error: Exec format error (8)

One possible explaination: Script uploaded to web account as a BINARY rather than an ASCII text file.

Scripts that are uploaded to your cgi-bin directory as a binary file will contain carriage returns (^M) at the end of each line. These are visible if you use the vi editor. You can tell if this is what's choking your script if you see this:

#!/usr/bin/perl^M

Unix interprets the carriage return as part of the name of the perl program rather than as part of the end of line character. Thus it can't execute the script because it can't find a program with that name.

There's a couple of ways to fix this. First you can edit the script in vi and type the following command:

:%s/^v^m//g

^v means hit the control and v keys simultaneously (CRL + v)
^m means hit the control and m keys simultaneously (CRL + m)

After saving (in vi, either ZZ or :wq), the carriage returns should be gone and you should be able to execute the script.

The second way to fix the problems would be to re-upload the perl script in ASCII mode rather than binary. This will prevent the ^Ms. If you get scripts from a site, and they provide both tar.Z or tar.gz and zip bundles, get either of the tar formats -- as those are Unix-friendly files.

 

CGIwrap Error: User not found in passwd file.
One possible explaination: You've neglected to tell cgi-wrap what loginID to use.

In this case, the user typed:

<form method="POST" action="http://mailer.fsu.edu/cgi-bin/cgiwrap/get-form.pl">

When he should have typed:

<form method="POST" action="http://mailer.fsu.edu/cgi-bin/cgiwrap/his_username/get-form.pl">

where your_username is YOUR username (your login ID). For example, smith936.


500 Internal Server Error
One possible explaination: You've neglected to put a ~ in front of your userid in the call to 'cgiwrap'.

In this case, the user typed:

<form method="POST" action="http://mailer.fsu.edu/cgi-bin/cgiwrap/username/get-form.pl">

When he should have typed:

<form method="POST" action="http://mailer.fsu.edu/cgi-bin/cgiwrap/~username/get-form.pl">

Keep in mind that the above instructions have to be followed EXACTLY. Also, watch for typos. Even one misplaced character will cause a script to fail.

***** If you need additional help, please see our list of help resources. Please NOTE: The Technology Services Help Desk will NOT help students with websites related to coursework.

Credit: CGIWrap was developed at the University of Missouri, Rolla