PHP LogoSimple Hit Counter


[Scripts Archive Main] | [Download Now | Requirements | Online Documentation ]

Simple Hit Counter is a text-based hit counter. You can use it on as many pages as you want. Call it via PHP include statements or SSI exec statements. The script will create a small file (a few bytes) for each page it keeps track of.

Requirements:

  • PHP 3.0 or newer
  • PHP must have permission to create and modify files on your system

If you get file permission errors when you try to use this script, you need to run it under a CGI wrapper instead of through the Apache PHP module. To do this, insert the following line at the top of the script:

#!/usr/bin/php

(Use the correct path to PHP on your system.) Rename the script from count.php to count.cgi. When it runs as a CGI, it should have permissions to create the counter data files.

Documentation

The script is easy to use. Just set the $datadir and $snoop variables near the top of the script. Make sure the directory you specified as $datadir exists with 755 permissions, then upload the script in ASCII mode and call it from your other PHP pages using an include() statement. To call the script using SSI (from an .shtml page), you'll need to follow the instructions under "Requirements" for running the script under a CGI wrapper.

 




Copyright 1999-2008 Shaun - Use this form to contact me.
This page looks best in every browser. That's why it doesn't have lots of bells and whistles.