Be careful when reading data in a loop. gzread() behaves a little differently than bzread() or fread(), it does NOT return false when reading past the end of stream. It instead returns an empty string.
So a loop like:
$handle = gzopen($file);
while (false !== $chunk = gzread($handle, $bytes)) {
//...
}
will loop indefinitely.