Some of the pididu.com pages have a counter on them, like the abacus at the bottom of this page, to show the number of times a page has been viewed.
These counters are hosted locally on my server. This is harder than just linking to a pre-made counter on someone else’s server, but allows more independence from other sites and their tracking. Herewith is how I implemented the counter.
First, I downloaded the source distribution for a counter from muquit.com
cd ~/Downloads tar -xzvf wwwcount2.6.tar.gz cd wwwcount2.6 # the following edits 4 files at once gedit configure configure.in Config.tmpl Count-config
The defaults in the source need to be changed to match the structure of the Linux release being used. For Ubuntu 16.04 or Raspbian Stretch, the changes must be made in all four files as follows. The changes must be made in the order shown.
- Change all occurences of “/usr/local/etc/Counter” to “/opt/Counter”
- Change all occurences of “/usr/local/apache/cgi-bin” to “/usr/lib/cgi-bin”
- Change all occurences of “/usr/local” to “/opt”
Here are the source files with those changes already made: Editedwwwcount2.6.tar.gz If you are using Ubuntu or Raspbian, you can use these files directly, rather than bothering with the editing.
Now the counter program must be compiled and installed.
cd ~/Downloads/wwwcount2.6 # I will use individual data files for the counts rather than a database ./build --with-cgi-bin-dir=/usr/lib/cgi-bin --without-database --prefix=/opt/Counter sudo ./build --install Continue? y Do you know the user and group id of httpd's child process? y Enter user id ... : www-data Enter group id ... : www-data
Finally, some code must be added to the page being counted. Mr. Muquit’s counter is rich in features, and there are too many to detail here. See his site for how to set things up. But as an example, the following code is what is used for this page. This specifies the file /opt/Count/data/smallproj1.count as where to keep the count, digit style as abacus, 6 digits, and a 6-pixel thick frame of color red. While there are a few fonts included with the source, abacus is not one of them. If you want it, you will need to get it from a site such as Digit Mania.
<p align="CENTER"><img src="/cgi-bin/Count.cgi?df=smallproj1.count&dd=realaba&md=6&pad=Y&ft=6&frgb=ff0000" alt="Count" /></p>
If nothing shows up after doing all this, possibly cgi-bin is not enabled on your server. Make sure there is a symbolic link as follows to enable serving cgi-bin:
cd /etc/apache2/conf-enabled sudo ln -s ../conf-available/serve-cgi-bin.conf cd /etc/apache2/mods-enabled sudo ln -s ../mods-available/cgi.load
By the way, this counter can also be used as a clock.
(My local time)
I leave it as an exercise to the reader to figure out how to read it. There actually is a logic behind this cryptic font I made.