Websites Counter Software in Debian

We are going to Install and Configure the WWWCounter Program in Debian


This is a CGI program to keep record of the raw hits of a web page. It generates a GIF image of the number of hits and returns to the browser as an in-lined image. The program also has a run-time option not to show the digit images, this way the hits can be kept without displaying it. The hits can be be monitored without incrementing from a separate page as well. The program can also can display time and date of any timezone. It has a option to countdown to a specific date (past or future).  This program started as a fun-to-play-with CGI program but due to enormous interest, feature request, input from thousands of you, it has turned in to the most configurable hit counter on the whole World Wide Web and it's free. The program runs on almost all Known Unix platforms, Windows NT, OS/2, VMS and Amiga.


 To know more features about this program click here

Supported Platforms

It is reported that the program runs on the following platforms:


Operating System

AIX 3.2.5
AIX 4.2.1






DomainOS 10.4.1 (on Apollo Workstns)

FreeBSD 2.1.5

OpenBSD (SPARC & i386)




NEXTSTEP 3.3,3.2,4.0 for Mach

NT 3.51 (intel)

NT 4.0 with IIS 2.0



SunOS 4.1.x

Solaris 2.x



SINIX 5.4 (SVR4, MX500I by Siemens


UnixWare 2/2.03






 A C compiler (ANSI or non-ANSI) if you are installing it on Unix.

 You should be familiar with Unix operating system in order to install it on Unix. I think if you know what ls command is, you qualify. If your site is configured to run CGI programs from users' space, then you will not need root access otherwise root access is needed.

  You must run a web server. The web server must be capable of running standard CGI programs. If you run several web servers in your domain, you can install the counter in one server and allow the users at other servers to access the counter remotely.

  The web server must be running on any of the Unix, NT, OS/2, VMS or Amiga Operating System.

Download source for WWWCounter 2.5 from the following link

Directory Structure (Linux)

Before going to the configuration procedure, please browse through the default directory structure below. It will help you answer questions about the configuration script. You can change the name of the directories as you please, but keep the directory structure same, it will make your life much easier. You do not have to create any of these directories, they will be created for you by the Count-install program. The only things you probably have to create are the individual datafiles (keep reading).

/usr/local/etc/Counter          <- Base Directory

    |-- Log                     <- Log Directory

    |   `-- CountX.X.log        <- Log file

    |-- conf                    <- Conf Directory

    |   `-- count.cfg           <- Configuration file

    |-- data                    <- Data Directory

    |   |-- sample.dat          <- data files

    |   |-- joe.dat

    |   |-- harry.dat

    |   `--


    |-- digits                  <- Digit Directory

    |   |-- A

    |   |   `-- strip.gif      

    |   |-- B

    |   |   `-- strip.gif

    |   |-- C                   Digit sub-directories and

    |   |   `-- strip.gif       image strip of different styles

    |   |-- D

    |   |   |-- lenna.gif

    |   |   `-- strip.gif

    |   |-- E

    |   |   `-- strip.gif

    |   |-- cd

    |   |   `-- strip.gif

    |   |-- cdd

    |   |   `-- strip.gif

    |   `-- cdr

    |       `-- strip.gif

    `-- rgb.txt                 <- color name database

Base Directory is the directory where all the sub-directories and the files related to counter reside.

Log Directory is the directory which holds the counter Log file. counter error messages and remote access warning messages are written to this directory.

conf directory holds the configuration file for the counter. This file is created by the program Gen-conf and can be hand crafted later. After creating the file, please read the comments in the file.

data directory holds all the datafiles for the counter. The datafiles stores the access counts of web pages. Each page must have a separate datafile. The datafile is specified at run-time. You will know about it later.

digits directory holds sub-directories with various styles of GIF digits. For example, A sub-directory holds the green led digits. The sub-directories have GIF digit files named zero.gif, one.gif...nine.gif. you will know about it later.

rgb.txt file is used to convert a color name (for example, cyan) to the appropriate red, green and blue color component. This file came from X consortium and is supplied with the distribution. You will know about the file later.

 Steps to compile and install (Linux)

You can compile with default settings or you can specify your own settings. To compile with the default settings (very simple), please go to the sub-section Compiling with defaule settings. or if you want the ability to change the default settings, at the shell prompt (shell prompt is where you type ls, read your mails etc.), type the following commands in the described order and press Return key:

Step 1

make config.h

The script Count-config will be executed. The script will ask questions with brief description. The script will generate the header file src/config.h.

Step 2

make all

The configured script will be executed first to create the Makefiles (libs/mcfg/Makefile, libs/combine/Makefile, libs/bigplus/Makefile, utils/mkstrip/Makefile, utils/extdgts/Makefile and src/Makefile) for your system. Then the programs Count.cgi, mkstrip and extdgts will be compiled and copied to the bin directory.

Step 3

make cfg

The script Gen-conf will be executed to create the counter run-time configuration file count.cfg. This script will ask you questions about your system. Answer them. This process will create the configuration file for the counter. Note: if your hostname has more than 3 parts, like, than the script will not take it. Just enter a 3 part name and then go back and edit the file by hand with your favorite text editor.

Step 4

make install

This is the final step. The script Count-install will install the necessary things for the counter in your system. You will need root access if you are installing it an area where root access is needed. This program will ask you some questions.

Compilation with default settings

Look at the Directory Structure section for the default directory structure of the counter. Please follow the steps below if this directory structure is OK with you:

Step 1

make all

Step 2

First edit Config.tmpl, modify CGIBIN_DIR to specify the correct path of the cgi-bin directory. Do not change anything else in this file. Then, at the shell prompt, type:

make install

Look at the Configuration file section. Authorize your host by adding it in at [authorized] section.

Test the program from command line (Linux)

A shell script is provided to test out the various features of counter. To test the program, at the shell prompt, type:

    cd tests


The program will create a file called Count2_5-ex.html. Load this file to your web browser to see the result of the tests.

 After Testing the counter software if you want setup this counter software for all of your clients you need to copy the Counter.cgi(This is located where you have chosen the CGIBIN_DIR)  program in all the users /cgi-bin/ directory.After copying this program you need to give the code to call from users websites.Donít forget to create a .dat file for each user in /etc/local/etc/Counter/data/ folder.

 How to call the program?

 If your web server is running on On Linux, you can refer to the program from web page like this:

If the web server is running on Linux:

    <img src="/cgi-bin/Count.cgi?df=sample.dat" align="absmiddle">

The string after the ? mark is called the QUERY_STRING. Make sure there are no newlines in the <img src= line and no space in the QUERY_STRING. In df=sample.dat, df means datafile and sample.dat is the counter datafile. The counter stores the hits in this file. This datafile is supplied. If you configured the counter to allow automatic datafile creation (look at count.cfg file), you can specify a datafile with df like df=count.dat. The file count.dat will be created for you if the permission to the data directory is correct.

If you configured not to allow automatic datafile creation (good thing), you have to create this file in the data directory. Change directory (cd) to the data directory and type:

    echo "1" > count.dat

 For more Examples for counter program click here

For more details,Configuration and support forums of this program can be found here