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, … waitingwaitingerrorkilling myselfwaiting … 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


Restart your apache and thats it ;)

  1. Mikkel says:

    Thu 25/02/10, 11:47 am

    Thanks a lot for this one. It works like a charm. Btw. it doesn't take much time to build either pecl and the zip-extension.


  2. Theo Denovan says:

    Sun 14/03/10, 2:00 am

    You're awesome, thanks for sharing that. I was trying to follow the instructions in someone's tweet without much luck.


Send your comment by mail.