|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-06-03 11:05 UTC] lapo at lapo dot it
Description:
------------
I used to use a little script (see below) to check logs from remote and it worked like a charm with PHP4.3.2 both on FreeBSD and Win2000 (CGI on IIS).
Upgrading to PHP5.0.0RC2, on Win2000, it gives timeout when file size is 'big' (e.g. it does definitely do so with a 5Mb log file).
Of course it should print only the last 5Kb of file, no matter the filesize.
BTW: using @fread($file, 1024 * $n) instead of @fpassthru($file) works perfectly and I'm doing so, but @fpassthru($file) SHOULD be more efficient and I wuold like it to work, anyway.
Reproduce code:
---------------
$log_file = ini_get('error_log');
$n = 5;
$file = @fopen($log_file, 'r');
@fseek($file, -1024 * $n, SEEK_END);
@fpassthru($file);
Expected result:
----------------
Last 5Kb of log file content.
Actual result:
--------------
CGI timeout.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 10:00:01 2025 UTC |
Hi, I have the same problem with the 4.3.8 php version. When I use this script set_time_limit(0); $fp = fopen ($path,"r"); $contents = fread($fp,5000000); echo $contents; $fp2 =fopen("temp.txt","w+"); fwrite($fp2,$contents); fclose($fp); fclose($fp2); echo "<br>size : ".filesize("temp.txt"); I try to open a file (size 26ko) All the time the filesize("temp.txt") result is 4092. I hadn't this problem with the version 4.2.x.