CGI and Perl

Installation and Configuration

Installation of the MiniVend package is simple. First download the mvend103.tar.gz file to a new directory, and then run the following commands:

gzip -d mvend103.tar.gz
 tar -xvf mvend103.tar

Fortunately, Mike has made it easy for you to configure the package for your Web server as well. Before you begin the configuration process, you must obtain the following information:

  • The directory of your server's document root. The default value with NCSA and Apache is /usr/local/etc/httpd/htdocs.
  • The directory of your server's CGI executables. The default value with NCSA and Apache is /usr/local/etc/httpd/cgi-bin.
  • The directory of your server's protected CGI executables. "Protected" in this case means that it requires a user to log in for access. Refer to Chapter 3 for more information.
  • The directory of your MiniVend installation. Normally, this directory is the one in which you untar the file.
  • The user ID number under which your Web server is run. It defaults to the user ID number for nobody.

The easiest way to configure MiniVend straight out of the tar file is to run the configure script, which is located in the MiniVend directory. It asks you several questions about your system, and it also figures out some information on its own such as where Perl is installed and whether or not you have installed all the necessary modules. The configure script is quite user-friendly and will prompt you for all the information it needs to know. In addition to setting up your configuration files, it also builds three executables: svend, vlink, and mat. Finally, it puts all the necessary items in the proper place, optionally installs the demo system, and starts the server.

Overview of Features

MiniVend can run in two different modes. In static mode, each CGI catalog request loads the database to generate the catalog page. In server mode, you start up a MiniVend server process that loads the product database once and serves the remaining CGI requests with the product information. As you can well imagine, server mode is much faster and is recommended. When you run in server mode, and your server goes down for some reason, one nice feature causes an automatic e-mail notification when someone attempts to access your catalog but cannot do so because the server is down.

Almost all your catalog pages are stored in a directory outside your usual Web server document root. The only pages that need to be visible to your Web server are the base HTML files. All other pages contain MiniVend tags and are stored in the directory specified by the PageDir directive in the minivend.cfg configuration file.

A remote administration tool that runs as a CGI script is put into a protected CGI executable directory. It enables you to administer your MiniVend site from any platform using your favorite browser. I describe this tool, called mat, in more detail later in the chapter.