|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28618 fpassthru gives script timeout
Submitted: 2004-06-03 11:05 UTC Modified: 2005-02-23 01:00 UTC
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:2 (100.0%)
From: lapo at lapo dot it Assigned:
Status: No Feedback Package: Filesystem function related
PHP Version: 5.0.0RC2 OS: Win2000
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2004-06-03 11:05 UTC] lapo at lapo dot it
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);

Expected result:
Last 5Kb of log file content.

Actual result:
CGI timeout.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-28 22:46 UTC] ericfabre69 at free dot fr

I have the same problem with the 4.3.8 php version.
When I use this script


$fp = fopen ($path,"r");
$contents = fread($fp,5000000);
echo $contents;
$fp2 =fopen("temp.txt","w+");
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.
 [2005-02-23 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sun Oct 25 03:01:24 2020 UTC