Re: Read Last Lines of a Text File
| From: | Matt Matijevich | Date: | Thu, 17 Jun 2004 18:34:41 +0000 |
| Subject: | Re: Read Last Lines of a Text File | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-188505@lists.php.net to get a copy of this message | ||
[snip]
<?php
$file ="/var/log/radius.log";
$fp = popen("/usr/bin/tail -$limit $file", 'r');
if (! $fp ) {
echo 'unable to pipe command';
}
while (!feof($fp) ) {
$line = fgets($fp, 4096);
print $line."<br>";
}
?>
I've tried bumping up the 4096 to a higher number because it currently
only
shows me 10 lines - I'd like to see about 30. No matter what I change
the
number to, it still only shows 10 lines. What do I need to do to get
more
that the 10 lines?
[/snip]
I am jumping in late so I might have missed it. What is $limit set
too? is it set to 30?