|  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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
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: Wed Dec 06 03:01:27 2023 UTC