4

I'm trying to perform a pecl install memcache with XAMPP on OS X Yosemite, but it fails to find zlib, producing this error:

checking for the location of ZLIB... no
checking for the location of zlib... configure: error: memcache support requires ZLIB.

Use --with-zlib-dir= to specify prefix where ZLIB include and library are located

ERROR: `/private/tmp/pear/temp/memcache/configure --enable-memcache-session=yes' failed

How to I install zlib so that this pecl install memcache can succeed?

Ja͢ck
  • 161,074
  • 33
  • 239
  • 294
MMuzammilQ
  • 147
  • 1
  • 11
  • Please format the question properly – Panther Apr 19 '15 at 07:12
  • Please read this: http://stackoverflow.com/help/formatting. Also, I feel your question is more appropriate on Server Fault. Please consider migrate your question. – Daniel Cheung Apr 19 '15 at 07:14
  • Clarified the question, formatted the command output and eliminated unnecessary detail so reader doesn't have to scroll, improved title to state actual problem – Paul Dixon Apr 19 '15 at 08:12
  • 2
    `brew install zlib` and then try again. – Ja͢ck Apr 22 '15 at 01:16
  • I don't agree about moving this to server fault. OSX is an environment that's commonly used for development therefore developers will face this issue. – Henry Jul 21 '15 at 03:37

1 Answers1

7
brew install zlib

If you haven't already done so

Next find the zlib headers:

locate zlib.h

You may find you have a few options to choose from.

/Applications/Xcode.app/Contents/Developer/Platforms/ etc

or

/usr/local/Cellar/zlib/1.2.8/include/zlib.h

I use brew wherever I can so I chose the brew version:

brew install php55-memcached --with-zlib-dir=/usr/local/Cellar/zlib/1.2.8/include/zlib.h

I assume passing this flag to pecl will have the same result.

Henry
  • 6,843
  • 2
  • 32
  • 35