note 90450 modified in function.fseek by danbrown
| From: | danbrown@php.net | Date: | Thu, 23 Apr 2009 13:07:44 +0000 |
| Subject: | note 90450 modified in function.fseek by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-153615@lists.php.net to get a copy of this message | ||
The tail example functions below will return a PHP memory limit error when trying to open large
files. Since tail is convenient for opening large logs, here is a function that lets you (provided
you have permission):
<?php
function unix_tail($lines,$file)
{
shell_exec("tail -n $lines $file > /tmp/phptail_$file");
$output = file_get_contents("/tmp/phptail_$file");
unlink("/tmp/phptail_$file");
return $output;
}
?>
--was--
The tail example functions below will return a PHP memory limit error when trying to open large
files. Since tail is convenient for opening large logs, here is a function that lets you (provided
you have permission):
<?
function unix_tail($lines,$file)
{
shell_exec("tail -n $lines $file > /tmp/phptail_$file");
$output = file_get_contents("/tmp/phptail_$file");
unlink("/tmp/phptail_$file");
return $output;
}
?>
http://php.net/manual/en/function.fseek.php