Re: Tailing a log file {!?}
| From: | Liam MacKenzie | Date: | Sat, 04 May 2002 07:32:26 +0000 |
| Subject: | Re: Tailing a log file {!?} | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-96125@lists.php.net to get a copy of this message | ||
OK, I did this and it does nothing but cause a loop and crash my browser...
<?
exec("tail -n 100 /www/logs/access.log",$result);
for ($i=0; $i<$result; $i++)
{
echo "$result<BR>";
}
?>
What's the problem with that?
Cheers,
Liam
----- Original Message -----
From: "Tom Rogers" <trogers@kwikin.com>
To: "Liam MacKenzie" <phplist@operationenigma.com>;
<php-general@lists.php.net>
Sent: Sunday, May 05, 2002 4:35 PM
Subject: Re: [PHP] Tailing a log file {!?}
Hi
You need
exec("tail -n 100 access_log",$result);
$result will be an array with the output of the command.
see http://www.php.net/manual/en/ref.exec.php
for more info
Tom
At 01:51 PM 4/05/2002, Liam MacKenzie wrote:
>Hi guys,
>
>just a simple question, how would I go about displaying the last 100 lines
>of a log file?
>I know that on the command line it's:
>tail -n 100 access_log
>
>Is there a PHP function to do this?
>
>Cheers,
>Liam
>
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php