|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2011-01-24 14:40 UTC] rilatonal at hotmail dot de
Description:
------------
I am in the need of supporting large files in PHP.
For the first time I tried to compile PHP on a machine with zlib 1.2.5 installed.
After that, gzopen (and the other gz.. functions) is gone and is being replaced by gzopen64 (or the other gz...64-functions).
Thats a big problem, because many PEAR-scripts (and other scripts, too) expect gzopen to be there!
ZLIB is there (see the test scripts), but gzopen not!
Test script:
---------------
CFLAGS="-g -O3 -m32 -D_FILE_OFFSET_BITS=64" ./configure --prefix=/tmp/php --with-config-file-path=/tmp/php/etc --disable-all -with-zlib
make
make install
/tmp/php/bin/php -r 'var_dump(function_exists("gzopen"));'
/tmp/php/bin/php -r 'var_dump(function_exists("gzopen64"));'
/tmp/php/bin/php -r '$fp = fopen("compress.zlib://hello-world.txt.gz", "wb"); fwrite($fp, "Hello World!\n"); fclose($fp);'
zcat hello-world.txt.gz
Expected result:
----------------
I expect gzopen to be there!
Actual result:
--------------
gzopen is being replaced by gzopen64!
Patcheszlib-largefile-function-renaming (last revision 2013-02-08 12:24 UTC by skettler@php.net)gzopen64 (last revision 2012-08-26 10:57 UTC by comments at sentfrom dot com) Pull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 23 23:00:01 2025 UTC |
Hi, I also got this "bug" with the latest zlib 1.2.5 as system lib and "-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE=1". Dirty solution: Define ZLIB_INTERNAL. # /usr/local/php/bin/php -r 'var_dump(function_exists("gzopen"));' bool(false) # export CFLAGS="... -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE=1 -DZLIB_INTERNAL=1" configure && make # sapi/cli/php -r 'var_dump(function_exists("gzopen"));' bool(true) Matching lines in zlib.h: #if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFILE-0 # define gzopen gzopen64 # define gzseek gzseek64 # define gztell gztell64 # define gzoffset gzoffset64 # define adler32_combine adler32_combine64 # define crc32_combine crc32_combine64 # ifdef _LARGEFILE64_SOURCE ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int)); ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile)); ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile)); ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); # endif #else ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *)); ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int)); ZEXTERN z_off_t ZEXPORT gztell OF((gzFile)); ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile)); ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); #endif Frank