This tutorial is about getting AWStats to work for you. The traffic reports generated by AWStats are invaluable in finding out important data about your customers and your website.
First we acquire the necessary programs and information to make AWStats work. Once this is all set up, maintenance is very easy and consumes little time.
AWStats is a set of Perl scripts, the main one being awstats.pl, that convert server-generated log files into traffic reports. These reports can be today, daily, weekly, monthly, or yearly.
If you want Smartlab Software to set up your site with AWStats, contact us.
I suggest running reports offline, except for today's report. I have experienced inconsistencies when running Perl from a browser. Perl may run fine from the command line on a 1and1 shared server but this requires a package I do not have. Besides, running offline provides privacy and, once set up, is easy and quick to do.
If you want to prevent any unauthorized access, do everything offline. 1and1 already has restricted access to your logs file.
An account with LINUX operating system running an Apache server, and PHP. Most LINUX accounts by other hosts should work and Windows hosts, too. All 1and1 LINUX accounts include PHP and Apache server.
Access to the server logs.
There are several pieces of information you will need to set up AWStats. This is for an Apache server using a LINUX package.
It is recommended to set up AWStats on your local computer, download the server logs, and do all the processing locally. It is pretty easy to do and once set up, very easy to maintain. This will take care of privacy issues.
The server's path to your root directory is needed. Use showinfo.php and it will be in DOCUMENT_ROOT. Create a file called showinfo.php with the following code in it:
<?php phpinfo(); ?>
Upload this to your server and run it by typing in the URL in your browser. Search for DOCUMENT_ROOT (it will be under Environment). The value of DOCUMENT_ROOT will be referred to as DOCROOT from now on. It will look something like this:
This is the path on the 1and1 server to your website root. Note the leading /.
Download AWStats exe package.
Packages for installing and running AWStats on you computer (not the server).
Download Perl (free) for Windows from Activestate. Currently the latest version is 188.8.131.524. Use the msi package.
gzip - used to uncompress log files locally. The AWStats Perl scripts use gzip. You can download gzip binaries from sourceforge.
If you plan on running AWStats online you will need these.
Perl on the 1and1 server (not included in the 1and 1Beginner package).
SSH - 1and1 business pkg and above. Gives command line access to Perl
on a 1and1 server. This may obviate the need to install Perl on
your local computer.
SSH = secure server access.
cron - runs periodic scripts (Business package and above)
* the file extension for a perl script is pl.
If you are using AWStats online this script will tell you which version of Perl is on the server.
Copy this code to a file called perlversion.pl and upload it to your server. This will tell you if Perl is working on the server by showing the current version of Perl.
#! /usr/bin/perl $command= $]; $title = "Perl Version"; print "Content-type: text/html\n\n"; print "<html><head><title>$title</title></head><body>"; print " <h1>$title</h1> \n"; print "Perl version : ".$command; print "</body></html>";
Run it by typing the script's URL. For example if you uploaded the script to the root directory on www.myserver.com enter in:
The current version of Perl should show up (like 5.008008) which is Perl version 5.8.8. To use AWStats, the Perl version needs to be higher than 5.00503 (or 5.5.3).
Next: Install AWStats
PATH editor - edit Windows' PATH variable