You are here: Log File - Counting "Hits" « PHP Programming Language « IT news, forums, messages
Log File - Counting "Hits"

Posted by StevePBurgess on 12/18/92 11:51

Hi. I have a script that runs every night on my server that counts the
hits for my hosted RSS feeds and puts the information into a MySQL
table which then feeds the live(ish) statistics graphs on the site.

I am using:

$log=implode('',file("access_log"));
$count=substr_count($log,"GET /feed7.xml");

for example to count the number of times feed7.xml is requested.

As the popularity of my site increases, however, I have started to
notice these errors in the error log:

PHP Fatal error: Allowed memory size of 8388608 bytes exhausted (tried
to allocate 10802165 bytes) in

I know I could increase the memory settings in PHP - but is there a
smarter way of counting entries in the log file without trying to load
the entire thing into memory first?

Thanks, in anticipation

Steve

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация