When trying to read a large file with php, you might run into the following error message from PHP:
failed to open stream: Value too large for defined data type
The reason why this is happening to you, might be because you have reached a limit of 32bit PHP. To handle files that are larger than 2gb, you may want to consider compiling php with CFLAGS="-D_FILE_OFFSET_BITS=64" ./configure etc – this of course also requires a 64bit system.
Note. You might be able to find a 64bit precompiled version of PHP, if not available from official sources – this can be useful if you don't want to spend a lot of time learning how to compile on your own.
If you are trying to gzip output from mysqldump with php, you might want to consider using gzip with mysqldump directly, instead of trying to load the file into PHP.
Large File Support (LFS)
You may also want to consider the limits of your curent operating system. For example – FAT32 will not work with files larger than 4GB on certain systems, and as low as 2GB in worst cases.
If possible, consider if there are ways around dealing with these files – even a file at 2gb is to be considered very big – unless working with video files or database backups.
Also keep in mind that reading large files, can take a lot of memory, potentially occupying resources from other processes on your sever!