I have a log file that can easily grow to 10+ megs. PHP seriously chokes on it - just reading each line causes the script to timeout at 30 seconds. I thought PHP would be able to speed through a file like this - after all, analog can rip through a 500 MB log file in about 5 seconds.
Here's two variations of my code:
$fp = fopen($stats, 'r');
while (fscanf($fp, "%s\t%s\n", $date, $id) == 2) {
$stats[$id][$date]++;
...
}
fclose($fp);
///////////////////////////////
$file = file($stats);
foreach($file as $line) {
list($date, $id) = explode("\t", $line);
...
}