A Simple PHP Visitor Counter

This article is designed to help you make a very simple hit counter for your php enabled website. I will talk you through each stage and explain both what is happening and why. There are many ways that we can achieve our goal of creating a visitor counter using PHP. In this article I will show you how to create one using a text file and how to incorporate it into any page using a simple code snippet.


  • A strong grasp of HTML is reccomended before attempting to tackle PHP.
  • A PHP enabled web server running PHP 4.x.x or higher on either a unix or Microsoft Windows platform.
  • This is a basic article, however some knowledge of PHP is desired, such as what functions are, what variables are and the basics of the syntax in general.