php.net |  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
Votes:2
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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: lapo at lapo dot it
New email:
PHP Version: OS:

 

 [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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-28 22:46 UTC] ericfabre69 at free dot fr
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.
 [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-2019 The PHP Group
All rights reserved.
Last updated: Sat Dec 14 04:01:23 2019 UTC