I have a site which is getting over 250,000 hits a day and I'm wondering what the least resource-intensive method would be to count hits per day.
I originally had a script that wrote a timestamp, visitor IP and referring url to a text file using fwrite().
My hosting company has since told me that the server was going nuts when the traffic started rising so I had to disable the script.
I'd like a script that updates a single figure and starts a new line every 24 hours if possible, but I'm unsure of the most economical PHP method for this.
I'd like to record it in a text file.
Can anyone offer any wisdom?
Oh my god. frwite? lol. Just insert it into a MySQL table lol. Use InnoDB as the engine table, otherwise MyISAM will lock the table until the last insert is done. I'd much rather have all the hit data like IP and page, but you could just SELECT and UPDATE it to the total. An insert would be faster though.
OR ... just look at the site stats (such as AWStats) that your hosting provider offers (e.g. via Cpanel or equivalent)?
This topic is now closed. New replies are no longer allowed.