©2000 ZipLink


Support Center:
Ziplink FAQs
Configurations
Contact Ziplink
Ziplink101


How to Get Cgi scripts to work on Ziplink


  1. Introduction and Setting Up
  2. Accessing CGI Scripts
  3. Using Server-Side Includes (SSI)
  4. Machine Differences


Introduction and Setting Up

CGI (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.

We ask that if you would like to have cgi enabled for your account, you either call our Support department at 978-551-8888 or email support@ziplink.net requesting such access be added to your account (there is no charge to do this).

The next step in using CGI is creating the directory. The directory must be named cgi-bin and reside in your www directory. If you have a UNIX shell account, to create this directory, log into your shell and type the following (Notes: If you do not have UNIX shell access the cgi-bin can be created through FTP. 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:

bash$ chmod 755 ~/www/cgi-bin/scriptname

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 5.003 version of perl.


Accessing CGI Scripts

Because 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:

http://www.ziplink.net/cgi-bin/cgiwrap/steve/test.pl

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 a 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 #exec cmd= command due to security concerns.


Machine Differences

Because your cgi scripts run on a different machine other 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 to check are file permissions. Make sure your scripts are all world readable and executable and all directories leading up to it are at least world executable. If you don't have a Unix shell account you will have to use an FTP program that lets you change file permissions. For more on this see our FTP FAQ.



News | Products | Support | ZipLinks | Graphics Off | Affiliates | Index | Help | Back to Top

©2000 ZipLink. All Rights Reserved.