SnowLeopard, PHP5 ZipArchive Support

First of all I would like PHP5 ZIP Support under MacOS X Snow Leopard. So there is an easy PECL Extension that could be installed with, but it wouldn’t work:

$ pecl install zip
[...]
php_pcre.h:29:18: error: pcre.h: No such file or directory
php_zip.c:602: error: 'pcre' undeclared (first use in this function)
[...]

Now i started to compile PHP myself, … *waiting*waiting*error*killing myself*waiting* … Okey it takes to long time. Currently i’ve found an really easy way to fix this problem.

First: Install MacPorts, it requires XCode.
Second: Compile PCRE with MacPorts

port install pcre


Third: Install the PECL ZIP extension via this special command :P

$ CPPFLAGS="-I/opt/local/include" pecl install zip


Fifth: Add the extension to the php.ini file /etc/php.ini

extension=zip.so

Restart your apache and thats it ;)