WWW Count 2.6 Frequently Asked Questions
sh: ar: not found, what's the problem?
1: Is there a support group or mailing list?
Answer: There is a mailing list setup for those who couldn't get their question answered on this page. To subscribe to the mailing list for WWWCount, please go to the URL: http://lists.yeehaw.net/mailman/listinfo/wwwcount/
NOTE: This list is a help forum, people will ask questions which might seem simple and annoying to you. Therefore, subscribe to the mailing list only if you like to help others.
Thanks to Ashley M. Kirchner for creating and maintaining the list.
2. My CGI scripts don't work. What's
Answer: Simply linking from your page to an executable program or script won't cause it to be run by the server. There are two common arrangements: either files in directories specially designated by the server administrator are executed as CGI scripts, or files with a special extension (such as .cgi) are executed as CGI scripts.
These are just two possible ways your server might be configured. Many sites don't allow users to run CGI scripts at all. Consult your web server's administrator.
Taken from WWW FAQ
: libCombine.a : - Too many arguments *** Error code 1 (bu21) *** Error code 1 (bu21)To make it work, in libs/combine/Makefile, remove the line
$(RANLIB) $@Or, try setting SHELL to sh, for example:
setenv SHELL "/bin/sh"Thanks to avarro@CENTRCN.UMontreal.CA (12/07/95)
4. Why does the counter show "888888" all the time?
Answer: The counter is running in strict mode (look at count.cfg file). When the counter runs in strict mode, if the browser does not return the environment variable HTTP_REFERER, the counter will display the image 888888 instead of serving the counter. The environment variable HTTP_REFERER should contain the web page running the counter. Some browsers do not return this variable in <img GET method.
Technical notes: The way HTTP_REFERER environment variable gets available to a CGI program is as follows: The browser sends a header like Referer: http://foo.com/page.html, then according to the CGI 1.1 specification the server can add HTTP_ followed by the header name and make it available to CGI program as environment variable. But according to CGI spec, the server can decide not to make these variables available to the CGI program. In this case, the counter will show 888888. Also, if the browser decides not the send the Referer header to the server, there will not be any environment variable called HTTP_REFERER, and the counter will show 888888. Good news is, netscape and MS IE both send Referer when <img src is is used to set an inline image, and apache and all good web servers also make this variable available to the CGI programs.
5. The counter does not compile on UnixWare with cc, why?
Answer: Note for UnixWare 2: Before running the configure script, set and export the environment variable CC to the string
6. The counter does not compile on Solaris with cc, why?
Answer: If you are using Sun's stock cc on Solaris, you may get errors about identifier re-declaration. Try defining
in Makefile, it might work. You should not have any problem if
you compile with gcc or ucb cc on Solaris.
7. I get an error message "Could not write to counter file:
x/y/sample.dat". What's the problem?
Answer: That means the user running the web server can not write to the datafile. The correct way to make it work is to change the owner of the datafile to the user running the web server and give read/write permission to that user only. You can only do that if you're the super user. If you are not the super user, you have to give read/write permission to world. In Unix, "chmod 666 file" will do that. But this will allow anyone to edit or delete your datafile.
8. What does it mean when you say "user running the web server"?
Answer: Web servers can be configured to run the CGI program as a unique user and a group. In apache web server, the user and the group is specified with the directive User and Group in httpd.conf file respectively. I suggest you create a unique user and group first. For the user, put a * in the password field in passwd file and use /bin/true as its shell. This way this user will never be able to login to the system. And all CGI programs should be owned by the user and read/write/execute permission to be given to that user only. Most of all, make sure you look at all the CGI programs in your system. CGI programs are always a security risk. But if you configured your server to execute CGI programs as a unique non-privileged user, the damage to your system will be minimal, in case security is compromised due to CGI programs.
9. The counter seems to display random number. What's the problem?
Answer: If you do not specify a datafile with df= parameter, the counter will display a random number.
10. I get an error message "Host foo.com is not authorized". What's the
Answer: Find the file count.cfg. Edit it with your favorite text editor. Add the hostname in the error message in the section [authorized]. If you do not have access to the file, you have to ask the person who installed the counter.
If you are running a system with many virtual domains, you will probably
want to list your IP addresses with wildcards. This prevents you from
having to add an entry every time a new virtual domain is added. As of
version 2.4, the referer host will be looked
up in DNS if the USE_DNS directive is defined during compilation.
Look at the comments in file
For example, if you have the class C IP address of 192.160.166.[1-254], instead of listing every virtual host in this domain you could add:
192.160.166.*to your config file in the [authorized] section. Note that this feature will NOT work with versions prior to Count 2.4. Warning: If you compile with
-DUSE_DNS=1, then hostname is resolved with each CGI request. This can be slow if your DNS server is busy or serving lots of requests. If DNS server does not respond, the counter will hang until resolving request times out.
11. What's the format of the data file?
Answer: Note: if Database support is on, datafile is not used, so it's only relevant if you're using an older version of counter or compiled without database support.
The counter data file is a text file. The format of this
The line does not end with new line.
The digits are the numeric ASCII characters and IP is the IP number of the last host visited the page. The $ at the end indicates the end of data. If you configured the counter to count reload, the datafile might contain something like: 3432432434$
Here the $ indicates the end of data as well.
Technical note: Before the release of Count 2.5 there was no $ to indicate the end of data. So ftruncate() was used to truncate the datafile before writing. It was kind of risky, because if the system was out of disk space, the data file was truncated to zero without any indication. It will also help data integrity for the systems where ftruncate() is not available.
12. How can I reset the counter?
Answer: (Only for older version of counter) To reset the counter, find the file specified with df= parameter, edit it with your favorite text editor. If you do not have access to the datafile, your sysadmin has to do it for you.
From Counter version 2.6+: use the suuplied tool editdb or CGI script count_admin.cgi.
13. How does this program handle remote execution?
Answer: If you do not know, in most cases any CGI program can be executed remotely without visiting the page with a browser. For example, a CGI program x.cgi (say it returns an in-lined image) in foo.com can be called from foobar.com as follows:
<img src="http://foo.com/cgi-bin/x.cgi">That is, someone somewhere on the Internet can refer to your counter and increase the hits and you will not have a clue. You will get the false impression of many people visiting your page.
So how does this program handle this? The counter program tries to get a environment variable called HTTP_REFERER for remote referrer. It is necessary to check this variable because when someone remotely refers to a CGI program on your machine, the variable REMOTE_ADDR will be the address of your machine. So checking REMOTE_ADDR will not work. Most of the modern browsers returns the env variable HTTP_REFERER. If the browser does not return the variable, counter will be served anyway. But you are not lost totally here. If you decided to ignore count for your host running httpd, the counter will be served but it will not be increased. So, I suggest ignore count for your own host. Gen-conf program is used for generating the configuration file. Due to the architecture of the web itself, there is not good solution of this problem, a determined evil hacker can always circumvent it.
14. What's the maximum number of hits the counter can handle?
Answer: By default compile time option, it can handle digits up to 80 character long which a very large number (99999999999999999999999999999999999999999999999999999999999999999999999999999999). It will not overflow in the life time of the Universe. However, this can be easily increased by editing the MAX_DIGITS directive in count.h :). Now a pop quiz, if a site gets one million hits/day, in which year will the counter overflow?
15. I sent you so many mails, how come you never respond?
Answer: I receive enormous number of mails. Please understand that no way I can answer all of the mails I receive. If the problem can be solved by reading the documentation, you won't hear from me, otherwise I try my best to respond. But often I just have too much to do and mails pile up. Instead of sending me mails, please subscribe to the mailing list and send mail there.
16. How can I turn off "Reload Ignore" feature?
Answer: This used to be a compile time option, but it is a run time option from Count 2.5+. In the options section of the configuration file specify count_reload=Yes if you want to count reload. Also if you do so, your counter users will have an option to ignore or count reload with the parameter reload=T or F.
17. Is there any way to compile the counter without running
the configuration scripts?
Answer: It's simple in Count 2.5+. Just compile with defaults settings as described in the section Compiling and installing of the counter main page.
18. Why do I have to add a line to the config file every time I add
a new virtual host?
Answer: It's a security feature, to prevent users on other systems from using your host as a "counter server". For information on automatically recognizing new virtual hosts as they're added, see the answer to question 9. (Contributed by: Sean Reifschneider email@example.com)
19. The counter does not seem to increment, what's going on?
Answer: It's a feature in the new release. It will only increment, if the visitor's IP and the one in the datafile (last visitor) differs. It's there to handle people pressing the "Reload" button continuously. If you do not like it, you can turn it off at compile time. Please read the answer to Question 15.
20. How do I configure the counter on virtual servers?
Answer: After running
Count-config normally, edit
src/config.h and change any references to directory paths in
line 13,15, 16 and 17 to include the part of the path your virtual server
can see. For example, if the real path is
/user/mysite/local/etc/httpd/cgi-bin, while the virtual
server might only access
(Contributed by: Jim Morrissey firstname.lastname@example.org.)
21. The counter seems to reset to zero occasionally, what's going on?
Answer: If you are using Count 2.5+, it should not happen. Only make sure that the disk partition where the datafile is located is not a NFS mounted partition. If it is NFS mounted, you might find counter process is hanging and consuming CPU and the data files are getting clobbered. The reason for this is, file locking is not reliable on all Unix over NFS.
22: While compiling, I get a message
sh: ar: not found,
what's the problem?
Answer: You see this message, because the location of the program ar is not in your PATH. You need to find out the location of ar first. To do this at the shell prompt type:
find / -name ar -printIf you are on a Solaris box, the output might look like:
/usr/ccs/binis the directory where ar is located. You need to add this location to your path. To do this, if your shell is csh or its variant, edit the file
.cshrcand put a like like:
set path = ( $path /usr/ccs/bin )Then source the file by typing:
PATH=$PATH:/usr/ccs/bin export PATHThen source the file by typing:
23. How to stop the browsers to cache the counter image?
Answer: If you want the browser to request the server for counter image each time you visit the page, use the parameters cache=F&expires=0. If the browser respects HTTP specification, it will not cache the image. You might want to do this if you're using the counter as clock to make sure the time is shown correctly each time someone visits the page. The downside to that is that the counter program gets executed each time as browser does not cache the image. Another tick is to change something in the parameter, like change ft or dd, so that the browser will notice the tag is changed and ask the server for the image.
24. Is there any way to stop showing error messages to the browsers?
Answer: Yes it's possible in Count 2.5+. It is specified in the configuration file with the keyword show_error_messages_to_browsers=Yes or No in the options section.
25. How to make a counter hidden (and monitor it from another page)?
Answer: Use the parameter sh=F. If you use the option sh=F, the counter program sends a 1 pixel by 1 pixel transparent GIF image to the browser, which gives an illusion of hidden counter.
Now if you want to monitor the hits from another page, use the option dbkey and specify the key for the web page you're going to monitor. You can find out the key for the web page from the database Authdb with utilities count_admin.pl CGI or editdb program or dumpdb program.
For some reason, if you're using datafile with the new version, you can use incr=F and df=datafile to monitor that counter of the page.
26. Can this program act as a text counter?
Answer: No. When you use the tag
<img src=, the browser
expects an image. However you can use digits or TrueType fonts
which look like text.
27. How does this program display time of various time zones?
Answer: This program uses offset from Greenwich Mean Time (GMT) to show time of various time zones. For example, to display US Eastern Standard Time using offset from GMT, use the parameter timezone like timezone=GMT-0500. Note, you must use 4 digit offset.
28. How to display countdown?
Answer: If you want to display countdown to year 2000 (a popular demand) just specify display=countdown& dd=cd Note: we specified dd=cd, as the default digit styles cd has all the necessary image segments to display countdown. To display countdown to a specific date (past or future) use the parameter cdt to specify the target date. If you like to show the current date with the countdown, use the parameter sfd. If you want to change the color of the from date, use the parameter prgb parameter. By default the countdown is calculated in reference to server time ( where the Count.cgi program is running). If you want display in reference to other timezonze (e.g. GMT) use the timezone parameter. Note: do not forget to use the parameters cache=F&expires =0 to force the browser to load a fresh countdown image instead of loading it from cache.
29. I get a error message "Counter datafile "x/y/foo.dat
must be created first!", how to create the file?
Answer: (it is only relevant if you're using the datafile for some reason)
In Unix, at the shell prompt type:
touch /x/y/foo.datGive read/write permission (600) to the user running the web server.
echo "1" > X:\x\y\foo.datReplace X: with the appropriate drive letter. If you see forward and back slash combination in the error message, do not worry, it's OK.
30. The counter seems to hang, what's going on?
Answer: If you are on Unix, make sure the data or database partition is not NFS mounted. If the partition is NFS mounted, the counter might hang when it initiates file locking.
31. I get error message about could not open
lock file for writing, what's going on?
Answer: Check the permission of the lock file. It must be writable by the user running the web server. It's possible you ran editdb as some other user, the lock file was created.
32. Is it possible to keep log about the visitors?
Answer: If log_visitor_info is to yes in count.cfg file, some info about the visitors are kept in log file. Please look at the directory structure for the location of visitor log file. Logs are written only if the counter hits were saved successfully. The visitor log can be analyzed with log analysis program like analog.
Please visit Log files page for details.
33. How can I tell what version of counter I'm running?
Answer: From command line type:
$ Count.cgi -version @(#) Count.cgi 2.6,(Aug-21-1999-1) By Muhammad A Muquit http://www.muquit.com/ Copyright 1995-2001 Muhammad A Muquit *Database support is on. Compiled with Berkeyley DbHash support *TrueType font support is on Compile options: -DSTDC_HEADERS=1 -DHAVE_SYS_WAIT_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_STRING_H=1 -DHAVE_FCNTL_H=1 -DHAVE_MEMORY_H=1 -DHAVE_MALLOC_H=1 -DHAVE_UNISTD_H=1 -DHAVE_CTYPE_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_PARAM_H=1 -DHAVE_SYS_FILE_H=1 -DHAVE_STDLIB_H=1 -DHAVE_FLOCK=1 -DHAVE_STRCASECMP=1 -DHAVE_MKTIME=1 -DHAVE_STRFTIME=1 -DHAVE_GMTIME=1 -DHAVE_DB_185_H=1 -DUSE_DATABASE=1 -DLDBM_USE_DBHASH=1 -DHAS_TRUE_TYPE=1 Compiled on: Sat Aug 21 13:06:54 EDT 1999 Compile time uname: Linux madina 2.0.36 #1 Tue Oct 13 22:17:11 EDT 1998 i686 unknownOr via web:
34. Is the counter Y2K compliant?
Answer: Because it is a free software, I will not guarantee that it is Y2K compliant, but I'm confident that it is. The program uses system time and date routines.
35. How many counter options are there
Answer: From command line type:
Or look at the documentation.
36. How to make the browser not to wait if the counter
is in a table?
Answer: You probably noticed if the counter is in a table, the browser does not display the page until it finished getting the counter digits. This is annoying if you're on a slow link. You can use the image compositing feature of the counter to avoid this problem. First create a strip of image with the same color of your page. Decide on the width and height of the strip, it will depend on the type of the digit styles. For example size of an individual digit in digit style is A is 15x20. So it's safe to create a base image say base.gif of size 150x22. Copy the image base.gif to digit style A directory. Now composite the counter on the image, and specify width and height of the image. Example:
<img src="/cgi-bin/Count.cgi?image=base.gif&align=midcenter" width=150 height=22>
37. Is version 2.6+ is backward compatible?
Answer: Yes if you specify the datafile with df parameter. That means if df is specified the counter acts just like the older version. From version 2.6+ there's no need to specify any datafile as page url is used a key in the database automatically.