Just write an IP addresses along with timestamp into a file. On a page load read this file, delete all records, say, 3 minutes older, add current IP and count the lines, write the file back. A lock on this file would be nice.
That's all. All other methods listed here are just overpowered for such a trifling thing, inaccurate by design, no matter the method you use.