ZipLink SupportNews | Products | Support | ZipLinks | Graphics On | Affiliates | Index | Help | Back to Top
Working with Cgiwrap How to Get Cgi scripts to work on Ziplink
6/12/96 Note: You no longer need to be put on an access list to use cgi.
Introduction and Setting UpCGI (Common Gateway Interface) scripts allow you more control over the look and feel of your pages. Using such programs, you can set up address books, counters, and other things that require a program to generate the output. At Ziplink, we allow full user CGI and server-side includes. Using a program called CGIWrap, your cgi scripts are run setuser as you and not a generic "Web" user. Not only does this protect the server, but it protects you from other people being able to mess around with data files. The first step in using CGI is creating the directory. The directory must be named cgi-bin and reside in your www directory. To create this directory, log into your shell account and type the following (Note: Examples are given assuming you're using the bash shell. Your prompt may vary, but the commands are still the same.) bash$ cd ~/www bash$ mkdir cgi-bin You may now place any scripts/programs you'd like in your cgi-bin directory. Note that any files to be executed must have their execute bit set. To do this, type:
Replacing scriptname with the name of the file, of course. :) Note: If the script is a perl script, it must have !#/usr/local/bin/perl as the first line of the script. This points to the 4.36 version of perl; we currently don't have perl5 installed on the Web machine (but we will soon.)
Accessing CGI ScriptsBecause we have cgiwrap installed, accessing CGI scripts is done differently than on other servers. Assuming your username is steve and the script you're executing is named test.pl, the url would be:
Your script will be executed as normal. For nph- (no parse header) scripts, replace cgiwrap in the above url with nph-cgiwrap. Your script's name doesn't need to start with nph-, but it's in good form to do so. The cgiwrap program also offers a useful debugging mode. In this mode you'll see the program being executed step by step, and where any problems occur. Additionally, stdout and sterr of the script are displayed. To use this mode, replace cgiwrap in the above example with cgiwrapd (for regular scripts) and nph-cgiwrapd (for no parse header scripts). Note: When calling cgi scripts in your page, you may refer to them as: /cgi-bin/cgiwrap/steve/test.pl Apache will assume that the script resides on the same machine as the page does.
Server Side Includes (SSI's)Because of our use of cgiwrap, referring to scripts using server side includes is once again different. Instead of using #exec cgi, we use an similar command: #include virtual. It's used the same way as #exec cgi is. Assume again, if you will, that your username is steve and your script's name is test.pl: <!--#include virtual="/cgi-bin/cgiwrap/steve/test.pl"--> This would execute the cgi script and place the output on your page.
We offer all server-side includes except the
Machine DifferencesBecause your cgi scripts run on a different machine than the shell machine, there are some differences. The major differences between the shell machines and the Web machine are the pathnames. On the shell machines, your Web directory is mounted as /www1/users/<username>. On www, this path is /www-pages/users/<username>. Also, there's no access to your shell home directory on www.
If something goes wrong, the first thing you want to check are file permissions.
Make sure that your scripts are all world readable/executable and that
all directories leading up to it are at least world executable.  
News | Products | Support | ZipLinks | Graphics On | Affiliates | Index | Help | Back to Top ©1997 ZipLink. All Rights Reserved. |