Home

installation
examples installation setup usage future

 

pwPage Installation

It shouldn't take a programmer experienced in C and mySQL more than 30 minutes from start to finish.  A person not familiar with one or the other or both C and mySQL, would be well advised to befriend an experienced programmer.  Said differently, this outline provides the necessary ingredients for compilation within a SUN operating system environment.  Chances are pretty good it will work just as well on numerous other UNIX and UN*X platforms, but you may encounter obstacles along the way. 

pwPage is provided in source form, hence it is necessary to compile this source into executables.  Since the programs are small and compile in a couple of seconds you shouldn't have much difficulty in compiling and linking your executables.  This assumes

  1. Capability of Creating mySQL Tables
  2. Capability of Compiling C Source and Linking in mySQL Modules
  3. You have access to cgi directory

Creating mySQL Tables

Review processing and subsequent selection is done with a rowid column.  This column is defined as follows within your mySQL table creation statements:

rowid BIGINT NOT NULL AUTO_INCREMENT,

This is a required column if you choose to use Review / Selection processing.   This approach allows a consistent record selection button appearance and size.

The rest of the columns in your mySQL table creates can be pretty much as you prefer.  The examples I've provided should provide a reasonable basis for defining your own.   mySQL software and documentation is available from http://www.mysql.com.

Compiling Compiling C Source and Linking in mySQL Modules

Note:  Although oftentimes not necessary, depending on how your directory structure is arranged and whether you fully qualify CGI's, images, pages, etc., you may need to establish a base HTML directory.  Whether you do or not, you will want to change the URL contained within the pwDisplay.c insertPageBaseURL function.

Additionally, you'll want to change the following variables within pwPage.h to those appropriate to your site:

char *pageHTMLDirectory = "http://www.domain.com/pwPage/";
char *fileHTMLDirectory = "/home/domain/pwPage/";
char *displayCGI = "/home/domain/pwPage/pwDisplay.cgi";
char *errorHTMLFile = "/home/domain/pwPage/error.html";

And, of course, you'll want to change the data base name to one of your own.  This is done by changing the following statement in pwPage.h:

#define sqlDatabase                 "pwPage"

The pwPage makefile I use is:

# pwPage Makefile
# Copyright 1996 - 1999 Phil Welch. All Rights Reserved.

MYSQL=/usr/local/mysql
HOME=/home/groups/pwpage
INCLUDE=${HOME}/dev/include
LIB=${HOME}/dev/lib
CF=-Wall -g -I./ -I${MYSQL}/include/ -I${INCLUDE}
LD=-L./ -L${LIB} -ldebug -lcgi -L${MYSQL}/lib -lmysqlclient -lnsl -lsocket -lm
CC=/usr/local/bin/gcc
AR=/usr/ccs/bin/ar

all: pwPage pwDisplay

pwPage: pwPage.c pwPage.h pwDisplay
    ${CC} ${CF} pwPage.c -o pwPage.cgi ${LD}

pwDisplay: pwDisplay.c
    ${CC} ${CF} pwDisplay.c -o pwDisplay.cgi

clean:
    rm -f *.o core a.out

The MYSQL variable should point to the home directory you or your ISP have allocated for mySQL.  Typically it will be /usr/local/mysql as shown.

The HOME variable is, in my case, used to augment the definition of your INCLUDE and LIB variables and is therefore not absolutely necessary if you choose to fully qualify your INCLUDE and LIB directories.

INCLUDE contains your C <header>.h files; although you could, of course, include them with your C <source>.c files.

LIB contains any libraries you use.  In my case, I have opted to use EEKim's cgihtml which is available from http://www.eekim.com/software/cgihtml/index.html.   Since very little of the functionality of this excellent package is used within pwPage, it could be replaced rather easily, but it would be a hard act to follow.   And perhaps more importantly, it's unlikely you'll find another package that provides the debugging options and numerous other features Eugene has engineered.

The CF (CFlags) variable can be used for whatever compilation options you choose.   In this instance, I've turned on warnings and debugging features, and have pointed to both local and mySQL include files.  Note that as provided, pwPage.c contains three include files used in support of EEKim's cgihtml, utilities.   These are:

#include "cgi-lib.h"
#include "html-lib.h"
#include "string-lib.h"

mysql.h is, of course, the mySQL header file usually found at /usr/local/mysql.

The LD (linkage editor) variable defines the component libraries needed in the final pwPage CGI and pwDisplay.cgi executables.

Although there are numerous other compilers available, I typically prefer to use the Free Software Foundation gcc compiler.  It's always been available to me on any ISP with which I've hosted.  However, there's nothing, of which I am aware, about pwPage that would preclude your use of any C compiler.  If gcc is not available, try what you have - chances are it'll work just fine.

 

Home ]

Copyright 1996 - 2000 Phil Welch.  All Rights Reserved.

Last modified: September 10, 2000