Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Install zip php extension?

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)

Posted on Sep 23, 2009 7:32 PM

Reply
4 replies

Sep 24, 2009 9:42 AM in response to Jason Smith7

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:
/usr/lib/php/extensions/no-debug-non-zts-20090626/
Then, to enable the extension, add the following line to /etc/php.ini:
extension=zip.so
Once you restart Web Service, the zip functions are available.

Sep 24, 2009 9:48 AM in response to A 

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?

Oct 22, 2009 6:55 PM in response to Jason Smith7

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

MACOSX DEPLOYMENTTARGET=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 -bind atload"

export CFLAGS CXXFLAGS LDFLAGS CCFLAGS MACOSX DEPLOYMENTTARGET

Now, the actual compilation:

phpize

./configure

make

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

extension=zip.so

and finally restart the webserver

sudo apachectl restart

Install zip php extension?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.