Re: Read Last Lines of a Text File

From: Date: Thu, 17 Jun 2004 18:42:25 +0000
Subject: Re: Read Last Lines of a Text File
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-188506@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? > I actually don't have limit set anywhere - I added: $limit="30"; directly under $file = ... and got exactly what I need. Thanks for all the help! Scott -- Outgoing mail is certified Virus Free. Checked by AVG Anti-Virus (http://www.grisoft.com). Version: 7.0.251 / Virus Database: 263.3.2 - Release Date: 6/15/2004

« previous php.general (#188506) next »