|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40726 fseek / ftell do not work correctly for files > 2GB
Submitted: 2007-03-05 11:19 UTC Modified: 2007-03-05 11:24 UTC
From: plamen at pulsator dot com Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 5.2.1 OS: FreeBSD 6.2 i386
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.
Bug Type:
From: plamen at pulsator dot com
New email:
PHP Version: OS:


 [2007-03-05 11:19 UTC] plamen at pulsator dot com
fseek does not move the pointer over 2GB limit even if Large File Support is compiled according to the Filesystem functions instruction at the php manual (but if you want PHP to support LFS (large files) on Linux, then you need to have a recent glibc and you need compile PHP with the following compiler flags: -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64. )
Consecutive ftell() calls return 0 

Reproduce code:
 $fp=fopen("Some Large File",'r');
 echo ftell($fp);

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-03-05 11:24 UTC]
PHP uses "signed long" internally.
We're still considering a possibility to add a cross-platform 64-bit long, though until it's done you're bound to your native long limits.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Dec 01 04:01:29 2023 UTC