fgets() is good for reading large files line by line. It sends back the next line as its return value.
string fgets ( resource $handle [, int $length ] )
Returns a string of up to length - 1 bytes read from the file pointed to by handle. If there is no more data to read in the file pointer, then FALSE is returned.
If an error occurs, FALSE is returned.
Reads a large log line by line:
<?PHP/*w ww . jav a 2 s . c o m*/
$access_log = fopen("access_log", "r");
while (!feof($access_log)) {
$line = fgets($access_log);
print $line;
print "\n";
}
fclose($access_log);
?>