XAMP 1.8.1 and zip.so

  • Posted on: 3 December 2012
  • By: markus.wilhelm

Dear all,
after upgrading to XAMP 1.8.1 the PHP extension zip.so was not delivered any more. Trying to install via pecl directly failed. After searching a long time I found some bugs in the code for PHP 5.4.7 (which is the version delivered by apachefriends) and compiled the zip extension.

Command line installation with pecl: pecl install zip
Failed with errors.

Errors found:
/tmp/pear/temp/zip/php_zip.c: In function 'php_zip_extract_file':
/tmp/pear/temp/zip/php_zip.c:187: error: 'struct _php_core_globals' has no member named 'safe_mode'
/tmp/pear/temp/zip/php_zip.c:187: error: 'CHECKUID_CHECK_FILE_AND_DIR' undeclared (first use in this function)
/tmp/pear/temp/zip/php_zip.c:187: error: (Each undeclared identifier is reported only once
/tmp/pear/temp/zip/php_zip.c:187: error: for each function it appears in.)
/tmp/pear/temp/zip/php_zip.c:241: error: 'struct _php_core_globals' has no member named 'safe_mode'
/tmp/pear/temp/zip/php_zip.c: In function 'php_zip_add_file':
/tmp/pear/temp/zip/php_zip.c:291: error: 'struct _php_core_globals' has no member named 'safe_mode'
/tmp/pear/temp/zip/php_zip.c:291: error: 'CHECKUID_CHECK_FILE_AND_DIR' undeclared (first use in this function)
/tmp/pear/temp/zip/php_zip.c: In function 'php_zip_glob':
/tmp/pear/temp/zip/php_zip.c:532: error: 'struct _php_core_globals' has no member named 'safe_mode'
/tmp/pear/temp/zip/php_zip.c:532: error: 'CHECKUID_CHECK_FILE_AND_DIR' undeclared (first use in this function)
/tmp/pear/temp/zip/php_zip.c: In function 'php_zip_pcre':
/tmp/pear/temp/zip/php_zip.c:594: error: 'struct _php_core_globals' has no member named 'safe_mode'
/tmp/pear/temp/zip/php_zip.c:594: error: 'CHECKUID_CHECK_FILE_AND_DIR' undeclared (first use in this function)
/tmp/pear/temp/zip/php_zip.c: In function 'php_zip_get_property_ptr_ptr':
/tmp/pear/temp/zip/php_zip.c:840: error: too few arguments to function 'std_hnd->get_property_ptr_ptr'
/tmp/pear/temp/zip/php_zip.c: In function 'php_zip_read_property':
/tmp/pear/temp/zip/php_zip.c:883: error: too few arguments to function 'std_hnd->read_property'
/tmp/pear/temp/zip/php_zip.c: In function 'php_zip_has_property':
/tmp/pear/temp/zip/php_zip.c:932: error: too few arguments to function 'std_hnd->has_property'
/tmp/pear/temp/zip/php_zip.c: In function 'php_zip_object_new':
/tmp/pear/temp/zip/php_zip.c:1044: error: 'zend_class_entry' has no member named 'default_properties'
/tmp/pear/temp/zip/php_zip.c: In function 'zif_zip_open':
/tmp/pear/temp/zip/php_zip.c:1147: error: 'struct _php_core_globals' has no member named 'safe_mode'
/tmp/pear/temp/zip/php_zip.c:1147: error: 'CHECKUID_CHECK_FILE_AND_DIR' undeclared (first use in this function)
/tmp/pear/temp/zip/php_zip.c: In function 'c_ziparchive_open':
/tmp/pear/temp/zip/php_zip.c:1436: error: 'struct _php_core_globals' has no member named 'safe_mode'
/tmp/pear/temp/zip/php_zip.c:1436: error: 'CHECKUID_CHECK_FILE_AND_DIR' undeclared (first use in this function)
/tmp/pear/temp/zip/php_zip.c: In function 'zm_startup_zip':
/tmp/pear/temp/zip/php_zip.c:2580: warning: assignment from incompatible pointer type
/tmp/pear/temp/zip/php_zip.c:2583: warning: assignment from incompatible pointer type
/tmp/pear/temp/zip/php_zip.c:2584: warning: assignment from incompatible pointer type

I changed some code in php_zip.c and php_zip.h of version: zip-1.10.2 (you can find changed files and the zip.so file in the attached php_zip.zip file)

Manual Installation:
export PHPPATH=/opt/lampp/
wget http://pecl.php.net/get/zip
tar -zxvf zip
cd zip-1.10.2/
./configure --with-php-config=$PHPPATH/bin/php-config --enable-zip
make

php.ini
After this I was ale to change php.ini file and my PHPExcel Class works again fine ;-)

zip

Zip enabled
Extension Version $Id: php_zip.c 284448 2009-07-20 15:26:54Z pajoye $
Zip version 1.9.1
Libzip version 0.9.0