|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32095 file_exists() doesn't work with 2G+ files
Submitted: 2005-02-24 18:04 UTC Modified: 2005-03-20 18:09 UTC
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: david at giffin dot org Assigned:
Status: No Feedback Package: Filesystem function related
PHP Version: 5.0.1 OS: Linux Debian
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2005-02-24 18:04 UTC] david at giffin dot org
file_exists() doesn't work under apache with files that are >= 2 gig. The script provided works using the cli version of php5 compilied on the same system at the same time as the apache version.

Reproduce code:

print "<pre>";
$file = "/tmp/tester.file";
for ($i = 0; $i < 6; $i++) {
        $cmd = "dd if=/dev/zero of=$file bs=1024 count=1024 seek={$i}M";
        echo $cmd . "\n";
        system("ls -lh $file");
        echo "File Exists: " . file_exists($file) . "\n";
        print "\n";
print "</pre>";


Expected result:
file_exists should return true even though the file is >= 2 gig

Actual result:
file_exists returns false if >= 2 gig


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-02-25 14:26 UTC]
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.

 [2005-03-20 18:09 UTC]
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

 [2006-03-07 17:03 UTC] steffen dot ryll at siemens dot com
This bug report describes the effect mentioned by "hiro at arkusa dot com" on

The Problem is, that file_exists($NameOfSomeLargeFile) returns false, if $NameOfSomeLargeFile exists *but is larger than 2 GB*.

In my case, I have backup.tar.gz with size of 6.6 GB.
I expect file_exists("backup.tar.gz") to return true, but it returns false.

System: Solaris 10 on SPARCv9, Apache/2.0.52 (Unix) DAV/2 PHP/5.0.5

I suspect php's limitation of int to 32 bits to be the cause, as filesize("backup.tar.gz") gives me an error, too. (PHP Warning:  filesize(): stat failed for ...)
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Oct 22 13:01:24 2020 UTC