DCANet Logo
Databases/Scripts
Databases
Scripts

DCANet

(888) 4-DCANET
Contact Us!

 

Services
Support
About Us
Contact Us

Home > Technical Support > Web Support >Legacy Hosting > Databases and Scripts > Scripts > CGIWrap

Requirements and limitations for UNIX CGI scripts using CGIWrap are as follows:

  • Scripts must be placed in a subdirectory of the public_html directory called "cgi-bin". For example, a user with username "joeuser" would put his script "test.pl" in:
    /home/joeuser/public_html/cgi-bin/test.pl
  • The public_html and cgi-bin directories, along with all the scripts in cgi-bin, must be world-executable. Use the command "chmod a+x filename" or "chmod a+x directoryname" to set the execute-allow bit for all users.
  • When FTP'ing Perl or shell scripts into your account, you must FTP them in ASCII mode and not binary mode. When FTP'ing text files from a DOS/Windows machine to Unix in binary mode, the MS-DOS end-of-line character (^M) is left which will cause your script not to run in Unix. FTP'ing in ASCII mode will strip these end-of-line characters for you.
  • The script will execute as if it were run by its owner; that is, a CGI script owned by user "joeuser" will run with all the rights and priveleges of joeuser's account when invoked via an HTML document or form.
  • The script must belong to the user who owns the directory. That is, if joeuser put a script in janeuser's public_html/cgi-bin directory, the script won't run.
  • The DCANet Web Server runs BSDI BSD/OS as its operating system, so any compiled executables must be for that architecture (Perl or shell scripts will work regardless).
  • The DCANet server will limit the CGI script to reasonable levels of CPU and bandwidth use.
  • All calls to user cgi-bin programs are logged on the DCANet web server.

* Before writing for help with your script, make sure you can run it from the command line (via entering ./scriptname at the Unix prompt) and try using CGIwrap's debug mode (see below) to help find any errors.

Running Your Scripts

To run your cgi-bin script, use the following syntax. We'll assume your username is "joeuser", and your script is called "test.pl". Here's a snippet of HTML code to show you how to invoke your script from an HTML document:

< a href="/cgi-bin/cgiwrap/joeuser/test.pl">Run test.pl</a>

Similarly, you can invoke your script from an HTML form. We recommend always using the POST method with HTML forms.

< form method=POST action="/cgi-bin/cgiwrap/joeuser/test.pl">

Note that in the above examples, your cgi-bin program is being invoked by another cgi-bin program called "cgiwrap". Cgi-wrap provides many added security features. More information about cgi-wrap is available at http://wwwcgi.umr.edu/~cgiwrap/.

Cgi-wrap has another feature, which allows you to run your script in "debug mode" to aid in debugging your script. To run your script in debug mode, invoke "cgiwrapd" instead of "cgiwrap", vis.:

< a href="/cgi-bin/cgiwrapd/joeuser/test.pl"> Run test.pl</a>

On a final note, please be careful in writing your scripts as it is possible to write a script which erases all the files in your account. If you have doubts about the security of your script, have someone more knowledgable about CGI and Unix security take a look at it.

HOME | WEBMAIL | NETWORK STATUS | SERVICES | SUPPORT | ABOUT US | CONTACT US
Privacy Policy/Copyright
Copyright © 1994-2024 DCANet is a division of Consult Dynamics Inc.