4 Replies Latest reply: Oct 22, 2009 6:55 PM by Jason Smith7
Jason Smith7 Level 1 (15 points)
10.6 has broken my zip.so I had grabbed from http://www.viames.it/mac-os-x.html
I have been unable to successfully compile the zip php extension myself. Does anybody out there have the slightest clue how I can get an 10.6 server friendly copy of zip.so?

Using the older 3rd party zip.so I get the following error: PHP Startup: zip: Unable to initialize module\nModule compiled with module API=20060613\nPHP compiled with module API=20090626\nThese options need to match\n in Unknown on line 0

No zip in php=no moodle 2.0

Xserve, Mac OS X (10.6.1)
  • A  Level 1 (35 points)
    Since 10.6 contains PHP 5.3, the PHP extensions directory has moved, and old extensions might not be compatible. But did you know that pecl and pear are now both available out of the box in 10.6? Assuming you have the developer tools, you can just install zip this way:
        sudo pecl install zip
    You'll notice that it places the zip.so extension in:
    Then, to enable the extension, add the following line to /etc/php.ini:
    Once you restart Web Service, the zip functions are available.
  • Jason Smith7 Level 1 (15 points)
    A nice idea, and would have made my day, unfortunately the result was:

    Notice: Array to string conversion in PEAR/REST/10.php on line 85

    Warning: Invalid argument supplied for foreach() in PEAR/REST/10.php on line 88

    Warning: Invalid argument supplied for foreach() in /usr/lib/php/PEAR/REST/10.php on line 88

    Fatal error: Cannot use string offset as an array in /usr/lib/php/PEAR/REST/10.php on line 256

    Any thoughts?
  • dklanac Level 1 (0 points)
    I am running into the error "/usr/include/php/ext/pcre/php_pcre.h:29:18: error: pcre.h: No such file or directory" when I run the pecl install zip or attempt to compile the extension from the 5.3 source at opensource.apple.com.

    Any ideas on how to fix the pcre.h file reference?
  • Jason Smith7 Level 1 (15 points)
    Solved, thanks to elance.at
    To install the zip extension, copy the missing pcre.h to /usr/include/php/ext/pcre/ and change the path

    sudo cp cd ~/php-5.3.0/ext/pcre/pcrelib/pcre.h /usr/include/php/ext/pcre/

    cd ~/php-5.3.0/ext/zip/

    Then tell the compiler to build for 32 and 64 bits on a mac os x 10.6


    CFLAGS="-arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp"

    CCFLAGS="-arch i386 -arch x86_64 -g -Os -pipe"

    CXXFLAGS="-arch i386 -arch x86_64 -g -Os -pipe"

    LDFLAGS="-arch i386 -arch x86_64 -bindatload"


    Now, the actual compilation:




    sudo cp ~/php-5.3.0/ext/zip/.libs/zip.so /usr/lib/php/extensions/no-debug-non-zts-20090626/

    add the following to the /etc/php.ini


    and finally restart the webserver

    sudo apachectl restart