Quick Setup of Apache, PHP, IMAP, MySQL and TWIG 
------------------------------------------------

This is the quick and dirty documentation, for complete details about
the individual packages, please see the documentation included with the
various packages.

WARNING*WARNING*WARNING*WARNING*WARNING*WARNING*WARNING*WARNING*

Building a server with a database on it that is publicly 
accessible to the Internet can be a LARGE security hole.  This
document takes no consideration of this and assumes that you
know what your doing about the security on the server and 
database.

WARNING*WARNING*WARNING*WARNING*WARNING*WARNING*WARNING*WARNING*

This procedure was completed on a basic installation of RedHat Linux
5.2, other distributions of Linux may vary slightly.

Assumptions:

	- you are logged in as root during the installation.

	- you have extracted your tar files in to /home/progs, 
	however if you have them somewhere else you will need to 
	replace /home/progs on the command lines with wherever you
	extracted the packages to.

	- You are using TWIG 2.4.0, if you are using a newer version
        you may need to change the archive and directory names.

	- you are using php 3.0.16, if you are using a newer version
        you may need to change the archive and directory names.

	- you are using apache 1.3.12, if you are using a newer version
        you may need to change the archive and directory names.

	- you are using the University of Washingtion's IMAP server
	version 4.7, if you are using a newer version you may need to 
	change the archive and directory names.

	- you are using MySQL version 3.22.32, if you are using a 
	newer version you may need to change the archive and directory 
	names.

	- all of the software (httpd, php, sql, etc.) are going to be
  	running on the same system.

Now on to the good stuff...

---

1 - download:
	ftp://ftp.php3.com/pub/php-3.0.16.tar.gz
	ftp://ftp.apache.org/dist/apache-1.3.12.tar.gz
	ftp://ftp.cac.washington.edu/imap/imap-4.7.tar.Z
	ftp://ftp.mysql.com/pub/mysql/Downloads/MySQL-3.22/mysql-3.22.32.tar.gz
	http://twig.screwdriver.net/download/twig-2.4.0.tar.gz

    in to a directory that you can work in (i.e. /home/progs)

2 - decompress the above:
	gzip -d php-3.0.16.tar.gz
	gzip -d apache-1.3.12.tar.gz
	gzip -d imap-4.7.tar.Z
	gzip -d twig-2.4.0.tar.gz
	gzip -d mysql-3.22.32.tar.gz

3 - untar the above
	tar -xvf php-3.0.16.tar
	tar -xvf apache-1.3.12.tar
	tar -xvf imap-4.7.tar
	tar -xvf twig-2.4.0.tar
	tar -xvf mysql-3.22.32.tar

4 - build IMAP
	change in to imap-4.7
	run make <system type> 
	(where system type is slx for linux with shadow passwords)
	change in to c-client
	run ln -s /home/progs/imap-4.7/c-client lib
	run ln -s /home/progs/imap-4.7/c-client include
	(I'm not sure why the links are required but it's the only 
	 way I've been able to get php to compile...)

5 - build MySQL
	change into mysql-3.22.32
	run configure
	run make	
	run make install
	run scripts/mysql_install_db
	run safe_mysqld &

	At this time you may want to add mysql to your startup 
	scripts to autostart each time you restart your system.

6 - make MySQL db's and table's and access rights
	This is where things get a little more complicated...

	First: decide on a name for the database (default is twig)
	henceforth referred to as <yourdbname>.
	
	Second: decide on a username (<username>) and 
	password (<password>) that you want to have TWIG access 
	the database as.  

	Third: make sure that you can access the mysql tools from 
        the command line (i.e. they are in your path)

	Fourth: decide on a root password for your 
	installation <rootpassword>

	NOTE: SQL names are case sensitive, so make sure you pay
        attention to the names you pick and type!

	Now, do the following:

	run mysql -u root mysql
	at the mysql prompt (mysql>) 
		enter CREATE DATABASE <yourdbname>;
		enter GRANT ALL PRIVILEGES ON *.* TO <username>@localhost IDENTIFIED BY '<password>';
		enter \q
	run mysql -u root <yourdbname> < /home/progs/twig-2.4.0/setup/twig.table.mysql
	run mysqladmin -u root password <rootpassword>
 
	The last run line changes your root password on the 
	database.  This must be done to ensure some level of
     	security.

7 - configure apache
	change into ../apache-1.3.12
	run ./configure

8 - configure and make php
	change into ../php-3.0.16
	run ./configure --with-apache=../apache_1.3.12
		        --enable-track-vars 
			--with-imap=/home/progs/imap-4.7/c-client 
			--with-mysql
	(note the full path in the --with-imap setting, 
	 it is REQUIRED to be the full path)
	run make
	run make install

9 - re-configure, build and install Apache
	change into ../apache-1.3.12
	run ./configure --activate-module=src/modules/php3/libphp3.a
	run make
	run make install
	
10 - configure apache
	edit apache's httpd.conf file and change the following lines:
	
		Add index.php3 to the DirectoryIndex line
		In the <Directory rootdir> section change AllowOverride to All

	Add the following line:

		AddType application/x-httpd-php3 .php3

	Add any other options you need for apache.

	At this time you may want to add apache to your startup 
	scripts to autostart each time you restart your system.

	run apachectl start, to start apache

11 - install TWIG
	change into ../twig-2.4.0
	run ./twig-install <doc root>/twig 
	(or where ever you want twig installed)
	
12 - configure TWIG
	change to the directory you installed TWIG to.
	change to the config directory
	edit config.inc.php3, dbconfig.inc.php3, header.inc.php3, 
	footer.inc.php4 and announcements (see TWIG's INSTALL 
	file for details about other files you may want to edit)

13 - test TWIG
	start a web browser and go to your TWIG root directory 
	and see if it works.

14 - done
	if you have any problems, take a look in TWIG's FAQ 
	file for some common problems and solutions.

	Also try running the test page (test.php3).

