In PHP4.4.1 I noticed that gzfile only reads up to 8190 bytes per line. I had a 20K SQL query that was cut into 3 parts - and wondered why the SQL server complained. 
Reading an uncompressed file with the file() command works as expected.(PHP 4, PHP 5, PHP 7, PHP 8)
gzfile — Gzipli dosyayı bir dizi içinde döndürür
Dosyanın içeriğini bir dizide döndürmesi dışında readgzfile() ile aynıdır.
dosyaismiOkunacak dosyanın ismi.
include_path_kullanBu isteğe bağlı bağımsız değişkenle 1 değerini aktarırsanız dosyanın include_path yönergesindeki yollarda da aranmasını sağlamış olursunuz.
   Her elemanında bir satır içermek üzere dosyayı içeren dizi ile döner. Boş
   satırlar dahildir ve satırsonu karakterleri
   kaldırılmaz, başarısızlık durumunda false döner.
  
Örnek 1 - gzfile() örneği
<?php
$satırlar = gzfile('birdosya.gz');
foreach ($satırlar as $satır) {
    echo $satır;
}
?>In PHP4.4.1 I noticed that gzfile only reads up to 8190 bytes per line. I had a 20K SQL query that was cut into 3 parts - and wondered why the SQL server complained. 
Reading an uncompressed file with the file() command works as expected.This function is not binary safe. (intentionally, or not, that's the question :)A quicker way to load a gziped file in a string :
<?php
function gzfile_get_contents($filename, $use_include_path = 0)
{
    //File does not exist
    if( !@file_exists($filename) )
    {    return false;    }
    
    //Read and imploding the array to produce a one line string
   $data = gzfile($filename, $use_include_path);
   $data = implode($data);
   return $data;
}
?>This works similar to gzfile() but it returns the file in a string instead of an array and doesn't write it to stdout compared to readgzfile.
Note: unlike the usual file-functions filesize won't work here, since the length-parameter of gzread refers to the uncompressed length, while filesize returns the size of the compressed file.
<?php
function gzfile_get_contents($filename, $use_include_path = 0) {
    $file = @gzopen($filename, 'rb', $use_include_path);
    if ($file) {
        $data = '';
        while (!gzeof($file)) {
            $data .= gzread($file, 1024);
        }
        gzclose($file);
    }
    return $data;
}
?>