Installing PHP MailStats
************************

The first thing you need to do is to make sure PHP was compiled
with the --with-gd option. If not, you need to recompile PHP and Apache.

The "mailstats2sql" script will require the stand-alone-binary version of PHP.
It's usually localed in /usr/local/bin/php. Please make sure you have this one.
If not, you need to recompile PHP without the --with-apache option.


Provide the scripts with an MySQL account to use
================================================
   You will need to modify all scripts to contain a valid username and password
for connection with the MySQL server. Those are the files that needs to be modified:
	mailstats2sql
	phpmailstats.php
	phpmailstats_init
	randomize_database


Initiate the database
=====================
   Just run ./phpmailstats_init once and it will create the database and all tables.


Using crontab to install "mailstats2sql" in the cron table
==========================================================

   Every hour "mailstats2sql" will be executed and store all new data
in a MySQL database of your choice. It will also reset /etc/sendmail.st.
The first time the script is executed the data in /etc/sendmail.st will
be added to the tables with total data. (So your old statistics won't be
lost).

   Copy "mailstats2sql" to for an example /usr/local/bin and type:

     # crontab -e

   Add the following line (if you use vi, press "i" to insert text):

0 */1 * * * /usr/local/bin/mailstats2sql 1> /dev/null 2> /dev/null
(To save and quit, type: ":wq <ENTER>")

   You might need to change the mailers you want to observe. The
default mailers are "local" and "relay". Change this at line 31 and 42
in "mailstats2sql".


Installing the PHP scripts
==========================

   Create a directory somewhere in htdocs. Place the "index.php" and
"phpmailstats.php" files in that directory. Done! That's all! :)


Testing
=======

   If the database doesn't contain any data a division by zero will
occur in the scripts, so you won't be able to view any diagrams before
the cronjob has filled the database with enough data.

   If you want to check if it works directly, please use the
"randomize_database" script.
