| 
	
 | 
 Posted by StevePBurgess on 06/17/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] 
 |