scandir call doesn't pick up files > 2G in size

Issue #357 wontfix
Former user created an issue


I am a new user of phpLiteadmin and I faced an issue where i was able to load databases < 1GB in size but when I moved to a database greater than 2GB, phpLite throws an error saying the database is not found. On further debug, I found that the error is coming from scandir function in phpLiteadmin.php where it doesn't even report the database as a file in my expected directory.

Can someone please clarify if this is a limitation or a bug and how to get around it?

Comments (7)

  1. phpLiteAdmin repo owner


    thanks for reporting. Please provide me some more details:

    • what php version are you using
    • what OS are you using?
    • what filesystem is used on the partition where the db is located

    To "get around it": If scanning for the files is really the problem, you can specify the file using the $databases config setting and set $directory=false. There is an example in the sample config.

  2. phpLiteAdmin repo owner

    I tried to reproduce this, but could not. I created a 2,28 GiB database (2.454.396.928 Bytes) and phpLiteAdmin works fine. This test was done on an NTFS filesystem on Windows 7 with PHP 5.6.31.

    Please provide more info on your setup. May it be that you are on an ext filesystem? not ext2 or ext4, but plain old ext? It does not support files larger than 2GiB. So this would mean it is a limitation of your filesystem.

  3. Rachit Garg


    Thanks for trying it out. Explicitly specifying the database using the $databases variable worked for me.

    Filesystem : ext4 Operating System: Linux PHPLiteAdmin Version: 1.9.7

  4. phpLiteAdmin repo owner

    I tried a 3,746,520 KiB file with PHP 7.2.24 on an ext4 filesystem using Ubuntu Linux 18.04 and the file was found. It seems this was a problem with a 32 bit PHP version. I found this in the php documentation:

    Note: Because PHP's integer type is signed and many platforms use 32bit integers, some filesystem functions may return unexpected results for files which are larger than 2GB.

    I think there is not much we can do about it. I added a note in the wiki that you need a 64bit php in order to work with databases > 2 GB:

    As most modern PHP installations should be 64bit, I guess we can close this issue.

  5. Log in to comment