High traffic website: Log & Hitcounter

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
calstap
Forum Newbie
Posts: 3
Joined: Thu Feb 23, 2012 7:15 am

High traffic website: Log & Hitcounter

Post by calstap »

Hey.

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 value from 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?
User avatar
theserve
Forum Newbie
Posts: 24
Joined: Wed Jan 18, 2012 6:35 am
Location: London

Re: High traffic website: Log & Hitcounter

Post by theserve »

I would suggest using a database (mysql) to track the hits. This would get rid of the corruption problem.
calstap
Forum Newbie
Posts: 3
Joined: Thu Feb 23, 2012 7:15 am

Re: High traffic website: Log & Hitcounter

Post by calstap »

MySQL server is already under heavy usage and I try to keep it at minimum. Site is hosted on shared server with some mysql limits and it's already getting average of 500 queries per second :?

I'd rather keep it file based, but is there any chance to do it that way?
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: High traffic website: Log & Hitcounter

Post by Celauran »

Do you not have access to your server's access logs?
calstap
Forum Newbie
Posts: 3
Joined: Thu Feb 23, 2012 7:15 am

Re: High traffic website: Log & Hitcounter

Post by calstap »

I can download them manually, not "automatically" so it doesn't work either
Post Reply