Page 1 of 2

AWStats: How to Install

PostPosted: 23. December 2004 07:44
by chuyskywalker
This took me a very long time to figure out, but I have successfully installed AWStats on XAMPP, and since it's a big mystery, I figured others might be interested.

First off, I am using XAMPP 1.4.9:

ApacheFriends XAMPP (basic package) version 1.4.9 (win32)

+ Apache 2.0.52
+ MySQL 4.0.21
+ PHP 5.0.2 + PHP 4.3.9 + PEAR
+ PHP-Switch win32 1.0 (by Apachefriends, use the "php-switch.bat")
+ MiniPerl 5.8.3
+ SQLite 2.8.15
+ PHPMyAdmin 2.6.0 pl1
+ ADODB 4.52
+ Mercury Mail Transport System for Win32 and NetWare Systems v4.01a
+ FileZilla FTP Server 0.9.3
+ Webalizer 2.01-10
+ Zend Optimizer 2.5.3




PERL Installation

The first thing you need to do to get ready to install AWStats is to realize that the version of PERL that comes with XAMPP (MiniPerl) is just that MINI. It is missing several libraries that AWStats needs to function.

So head over to ActiveState.com and download ActivePerl.

Once you have got it, go to your XAMPP install directory, delete or rename the perl folder. You will be replacing that PERL with this new one.

Now run the install for ActivePerl and install to XAMPP\perl

Now there should be an exe on this path after installation: XAMPP\perl\bin\perl.exe - if that is not true, try again.



AWStats Installation

Now, you are ready to start installing AWStats. Head over to their site and get the latest download. I used 6.2 - Just get the zip file.

Extract that and open the awstats folder. Open the wwwroot folder.

Copy the icon, css, and js folders into XAMPP\htdocs thus placing them in the webroot.

Now, go into XAMPP\cgi-bin\ and create a folder called awstats. Copy all the files from AWSTATS-ZIPFILE\wwwroot\cgi-bin into the folder you just made.



A Note Before We Continue

It is at this point in the tutorial that things are going to get different for each installation of XAMPP because we need to start using absolute paths. For my system, the absolute path to the XAMPP install is:

Code: Select all
C:\xampp\


So, if I say XAMPP_PATH, that is what I am referring to.



AWStats Configuration

Go into XAMPP\cgi-bin\awstats and rename awstats.model.conf to awstats.conf. Open the file.

In the file there are several important lines that you need to change:

1) Line 51.
Code: Select all
LogFile="/var/log/httpd/mylog.log"

Change this line to the
Code: Select all
XAMPP_PATH\apache\logs\access.log


2) Line 117.
Code: Select all
LogFormat=1

Change that to
Code: Select all
LogFormat=4


3) Line 206
Code: Select all
DirCgi="/cgi-bin"

Change to
Code: Select all
DirCgi="/cgi-bin/awstats"


Other lines of interest (Read their info):

Line 147
Line 162
Line 233



Running AWStats

The best way to run AWStats and update your stats is via a command prompt, or a bat file once you've gotten the hang of it.

Open the "Start" menu -> "Run..." -> "cmd.exe"

Then run
Code: Select all
XAMPP_PATH\perl\bin\perl.exe XAMPP_PATH\cgi-bin\awstats.pl -config=WWW_YOURHOST_COM -update
where WWW_YOURHOST_COM is your host (for me it is hq.servequake.com)

The first time you run this will take a very long time if you have a large log file to be parsed. Mine took ages (but my computer is a pile of old junk, and the log file was three months long)



Other Options

At this point you'll want to begin investigation other options for AWStats as it has many powerful features:

Update Via Browser
Referrer Tracking
Search Engine Query Tracking
User Tracking (Screen size, plugin availability, etc)
And other great stuff...

But most of it falls outside of the scope of what I am trying to get set up here - AWStats functioning.



One Last Thing

I do, however, highly reccommend that you change the APACHE log format. The default in XAMPP is leaving out important information such as referrer and user agent.

1) Open XAMPP\apache\conf\httpd.conf find the string
Code: Select all
#CustomLog logs/access.log combined
and change it to
Code: Select all
CustomLog logs/access-full-clf.log combined


2) Restart the apache server (XAMPP_Stop, XAMPP_Start)

3) Change the awstats.conf to point at the new access log and change the "LogFormat" back to '1'

You wont have access statistics for the previous log files, but the new ones will be much more useful and complete.

PostPosted: 24. December 2004 10:39
by JAB Creations
Finally a developer with the concept of a logical walkthrough! You will probally save countless people years worth of aggravation! Hail to you sir!

There are two errors I encountered AFTER following your tutorial

*AND* I have the solutions for them ...

1.) Error ...
[error] [client 127.0.0.1] (OS 3)The system cannot find the path specified.

Solution - You need to open awstats.pl and set the path ... so just skip to #2...

2.) Error ...
[error] [client 127.0.0.1] (OS 5)Access is denied. : couldn't spawn child process:

Solution - You need to set the full path WITH the perl.exe at the end. Because I install my programs in non-default folders here is my example...

The VERY first line in your awstats.pl (in windows open with WORDPAD to reformat the file to be readable ... just save ... then open with notepad or your desired text editor) ....

Change this ...
#!/usr/bin/perl

In to this ...
#!C:/MEDIA/INTERNET/Apache/xampp/perl/bin/perl.exe

Your path will 99.9999999% surely be different so just make sure you use / instead of \ and that you have #! at the begining and perl.exe at the end.

Right, but remember the standards

PostPosted: 27. December 2004 02:42
by chanio
:lol: Thanks for all your efforts.
But before installing ActivePerl you should try installing Xampp's complete Perl . (just under the normal Xampp downloading) It's more standard and easy than installing ActivePerl that normally would install just on C: drive.
If you install the complete Perl over your first Miniperl (just place it over the previous installation) you'll have very little to worry.
Besides that, all what you have explained is very usefull and I am going to copy it as a help file.
Remember that Xampp's perl is also from ActivePerl, so you would be also able to use PPM at the bin\ folder to add more APs modules.

PostPosted: 27. December 2004 21:39
by chuyskywalker
JAB Creations wrote:Finally a developer with the concept of a logical walkthrough! You will probally save countless people years worth of aggravation! Hail to you sir!


Gosh, gee ya made me blush! Thanks. :D

JAB Creations wrote:Change this ...
#!/usr/bin/perl

In to this ...
#!C:/MEDIA/INTERNET/Apache/xampp/perl/bin/perl.exe


Thanks for pointing that out - I knew I'd forget a step, just too damn many :D

chanio wrote:Xampp's complete Perl . (just under the normal Xampp downloading) It's more standard and easy than installing ActivePerl


Ah, didn't know that existed - heh. Yeah, if that works, go nuts.

awstats

PostPosted: 21. January 2005 04:32
by No-Sense
how can i acces the statistics from my webpage?

everything works fine according to the installation guide above.

Re: awstats

PostPosted: 21. January 2005 05:50
by chuyskywalker
No-Sense wrote:how can i acces the statistics from my webpage?


http://YOURSERVER/cgi-bin/awstats/awstats.pl

Should do the trick.

PostPosted: 21. January 2005 12:17
by No-Sense
when i did that i got a server 500 error. probably i did something wrong.gonna try one more time

PostPosted: 21. January 2005 23:16
by No-Sense
still getting a server 500 error :(
what am i doing wrong.
i use a freshly installed xampp with the perl addon. absolutky changed nothing

PostPosted: 22. January 2005 01:05
by chuyskywalker
No-Sense wrote:still getting a server 500 error :(


500 is a script/configuration error.

What platform are you on?

Can you run "perl.exe awstats.pl" (win) or "perl awstats.pl" from a command line?

PostPosted: 22. January 2005 11:36
by No-Sense
i run win xp as a server platform.but i already solved the problem. in the "perl.conf" there are some lines that you have to enable if you want to run on a windows platform.
Code: Select all
#### Only for NT + w2k + XP Professional ####
#<Files *.pl>
#SetHandler perl-script
#erlResponseHandler ModPerl::Registry
#ptions +ExecCGI
#erlOptions +ParseHeaders
#/Files>

#Files ~ (\.asp)>
#  SetHandler  perl-script
#  PerlHandler Apache::ASP
#  PerlSetVar  Global .
#  PerlSetVar  StateDir "/xampp/tmp"
</Files>
###########################################


if you remove "#" before these lines all problems are solved.

PostPosted: 25. March 2005 16:31
by sbmman
where can I find the perl.conf file?

Super, vielen Dank :)

PostPosted: 08. March 2006 17:18
by frolleinwunder.net
Vielen Danke für die gute Anleitung!

Ein paar kleine Fehler hat diese zwar, aber nicht der Rede wert.

Ich benutzte noch lokal Apache/2.0.54 und entsprechendes Pearl Plugin.
Die Pearl Installation, hab ich nach deren readme.txt Anweisung gemacht.

Code: Select all
XAMPP_PATH\apache\logs\access.log

( \ mit / ersetzten)

Code: Select all
XAMPP_PATH\perl\bin\perl.exe XAMPP_PATH\cgi-bin\awstats.pl -config=WWW_YOURHOST_COM -update

(der Pfad XAMPP_PATH\cgi-bin\awstats.pl mussXAMPP_PATH\cgi-bin\awstats\awstats.pl sein)
WWW_YOURHOST_COM hab ich mit localhost ersetzt

Dann musste ich die awstats.pl noch ändern ( 1 Zeile )
Code: Select all
#!D:\xampp\perl\bin\perl.exe


Mein Install Pfad ist D:\xampp\

Meine Änderungen in der awstats.conf

SiteDomain="localhost"
LogFile="D:/xampp/apache/logs/access.log" #später LogFile="D:/xampp/apache/logs/access-full-clf.log"
LogFormat=4 # später wieder auf 1
DirCgi="/cgi-bin/awstats"

Hoffe, dass ich jetzt keine fehler gemacht habe.

PostPosted: 09. March 2006 00:13
by JAB Creations
The most common issue for 500 error is that you have not CHMODed the correct permissions. Set the perl scripts permissions to 755 or -rwxr-xr-x.

awstats for multiple sites

PostPosted: 18. April 2006 15:42
by michaelhyk
Howdy,

For those of you running multiple sites, you can follow the instructions above and make copy of "awstats.pl" & "awstats.conf" and rename it to a different file name and change the contents of .conf to reflect a different site.

For e.g. I have awstats.pl & awstats.conf for my main site at mysite.com and then I have awstats-2.pl & awstats-2.conf for my secondary site at mysecondarysite.com

Hope someone will find this useful.


Cheers.

Re: AWStats: How to Install

PostPosted: 08. November 2009 18:34
by chris_bbg333
Hi,
awstats is installed, thanks to you. now I have the problem that it shows me the results of myself of today (127.0.0.1).
However I entered in the file cgi-bin/awstats/swstats.conf the following code LogFile="D:\xampp\awstats_logfiles\access.log"

in this file my access.log is located. what could my mistake be?