How to install PHP Zip Extension for MAMP 1.9

2

Posted on : 12-07-2010 | By : Brett | In : Mac, PHP

Foreword

Lately, when attempting to install extensions for MAMP, I’ve had a difficult time making my extensions work properly because my Darwin ports settings seem to override. Fortunately, I recently found a blog post with instructions that worked. There are a few steps that are different, however, for getting this to work with version 1.9. Therefore, I decided to post the original instructions with those modifications here.

Acknowledgments

The following instructions are modified for MAMP version 1.9 and originally posted by Saverio at http://developers.enormego.com.

Instructions

  1. Download MAMP’s “Source” package, located here. If the link doesn’t work, look for and download the MAMP_components_1.9.dmg file located on this page: http://sourceforge.net/projects/mamp/files
  2. Mount the DMG image and look for the PHP version that you’re using (php-5.2.13 or php-5.3.2) and unzip that archive. (Use the Archive Utility. Mine gets extracted to my Downloads folder.)
  3. Open terminal and cd to the PHP directory that you just unzipped (/Users/you/Downloads most likely.)
  4. Run the following command in terminal:
    ./configure –prefix=/tmp/php
  5. Wait for the configure script to finish and then run:
    export PATH=/tmp/php/bin:$PATH
  6. Now, cd to the zip extension directory:
    cd ext/zip
  7. Run:
    phpize
  8. Run:
    ./configure
  9. Wait for it to finish and then run:
    make
  10. Wait for it to finish and then run:
    sudo make install — (You’ll need to type your administrative password.)
  11. After it’s done running, you’ll see something like this:
    Installing shared extensions:     /usr/lib/php/extensions/no-debug-non-zts-20060613/
  12. Copy the zip.so extension file from that directory to your PHP installation’s extension directory:
    cp /usr/lib/php/extensions/no-debug-non-zts-20060613/zip.so /Applications/MAMP/bin/php5.2/lib/php/extensions/no-debug-non-zts-20060613/

Update

As of MAMP version 1.9.3, the zip extension is included. Thus, the easiest way to get it, is to upgrade. Consider this post DEPRECATED!

Comments

Could you please post the zip.so (for 5.3.2)?

I actually built the extension for 5.2.13, so I don’t have it for 5.3.2. Seems like I was able to get this working for another 5.3 extension though, but it required a change to either a make config file or an environment variable (wish I would have documented that!) Perhaps, I’ll try compiling this module for 5.3.2. If I do, I’ll be sure to post the method and the binary (I’ll also send you an email to let you know.)

Post a comment