View Full Version : High traffic website: Log & Hitcounter

02-23-2012, 03:40 PM

I have a quite high traffic website, around 200 users constantly browsing the site and up to 200k pageviews per day.

I'd like make full log of the page visists and have a hitcounter for some pages.

I made a simple php script that reads/writes hit values from/to files. The file got constantly corrupted or something similar and the counter started from 0 again.

I'm still quite beginner with php.
What is the best way to make a hit counter for such a high traffic page?
And how about the logs?

02-23-2012, 04:02 PM
there is a site that can do this for you, its really good and ive used it before, its called statcounter, as far as i remember its free, plus its invisable :)

here is the link:



02-23-2012, 04:21 PM
I'd like to keep my site running on it's own without need of any "external" services.

There must be some other solution.

But thanks anyways :thumbsup:

02-24-2012, 06:10 PM
To reduce the chance of file corruption you could continue with the file idea, but every hour use a cron job to parse all the data from the file to your mysql database, then wipe the file clean. This way the chance of file corruption is lower and your database only takes a performance hit every hour for a few seconds.