Smartlab Software logo

Set up AWStats on Shared 1and1 Server

AWStats logo 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.


  1. Acquire AWStats, other programs, and pertinent information
  2. Install AWStats on the 1and1 shared server
  3. Install AWStats on your computer
  4. Set up the AWStats config file
  5. Create a usable log file
  6. Create/update the AWStats database
  7. Create a traffic web page
  8. Create report batch files
  9. Analyze the traffic page
  10. Tasks

Extending AWStats

  1. Extras
  2. Geographic Plug-ins
  3. How To


  1. Glossary
  2. FAQ
  3. Pages not found FAQ
  4. Stop Referrer Spam


AWStats is a set of Perl scripts, the main one being, 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.


In a full log analysis, AWStats will show you several statistics, including:
  • Number of visits and number of unique visitors
  • Visits duration and last visits
  • Authenticated users and last authenticated visits
  • Days of week and rush hours (pages, hits, KB for each hour and day of the week)
  • Domains/countries of hosts visitors (pages, hits, KB)
  • Hosts list, last visits, and unresolved IP addresses list
  • Most viewed, entry, and exit pages
  • File type
  • Web compression statistics (for mod_gzip or mod_deflate)
  • Browsers used (pages, hits, KB for each browser and each version)
  • OS used (pages, hits, KB for each OS, 31 OS detected)
  • Visits of robots
  • Search engines, keyphrases, and keywords used to find your site
  • HTTP errors (Page Not Found with last referrer)
  • Screen size


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.

Gathering Information

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.

Server Information


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 /.

Software Packages


AWStats - Download AWStats exe package.

Packages for Installing Locally

Packages for installing and running AWStats on you computer (not the server).


Download Perl (free) for Windows from Activestate. Currently the latest version is Use the msi package.


gzip - used to uncompress log files locally. The AWStats Perl scripts use gzip. You can download gzip binaries from sourceforge.

Packages for Online

If you plan on running AWStats online you will need these.


Perl on the 1and1 server  (not included in the 1and 1Beginner package).


(optional) 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.


(optional) cron - runs periodic scripts (Business package and above)

Helpful Notes

* the file extension for a perl script is pl.

Helpful Scripts

Perl Version Script

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 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 "

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 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

Related resources

PATH editor - edit Windows' PATH variable