Hello CGI Sample

This is the simplist possible CGI program. When invoked it displays a greeting in the browser.

Building the Sample

To build the sample:

  1. Write your CGI script. Compile it and link it with the libraries acgi and list into an .xpl file.

Running the Sample

Installing CGI programs can be complex, and depends on the web server you are using. Regardless of the web server, the following tasks must be completed:

  1. Copy the CGI script and the executable acgi[.exe] (from amzi/lsapis/cgi) to the directory your web server runs CGI programs from (usually cgi-bin under Unix or Scripts under Windows).
  2. Rename acgi[.exe] to have the same name as your XPL file. For example, hellocgi.exe runs hellocgi.xpl.
  3. Ensure the process that runs your web server can find the Amzi! Logic Server (amzi.dll or libamzi.so). This might mean putting the library on your path or another environment variable, or copying it to cgi-bin or the /usr/lib directory.
  4. If you are using a .cfg file, ensure the web server process can find it. This might mean putting it in cgi-bin or having the AMZI_DIR environment variable set for the web server process.
  5. Ensure your web server process and read and/or execute access to all of the above files.
To help in debugging CGI scripts, you will want to consult the error log files for your server.

Following are some sample set-ups.

Windows with IIS/PWS

Copy the .xpl file, the .exe (copied from acgi.exe), amzi.dll and amzi.cfg to the /InetPub/Scripts directory. Also, using the IIS or PWS Manager enable both "Scripts" and "Executables" on the Scripts directory.

Windows with Netscape FastTrack

Copy the .xpl file, the .exe (copied from acgi.exe), amzi.dll and amzi.cfg in the cgi-bin directory.

Solaris with Apache

Copy the .xpl file and acgi (renamed) to the /apache/cgi-bin directory. Use Apache directives to tell it where to find libamzi.so or copy libamzi.so to /lib. Use the Apache setEnv or passEnv directives to set the value of AMZI_DIR and put your amzi.cfg file in /amzi/config.