This post aims to explain how to compile a PHP extension for ZendServer CE on Mac OS X based on my experience with the memcache extension. As it turns out, the memcache extension included in ZendServer CE 5.0.4 is version 2.2.5 which doesn’t work with the latest version of the memcached server insatlled by macposts as detailed in my earlier post about memcached. I had to build the extension version 2.6 using pecl. Here’s how

  • go to /usr/local/zend/lib/php_extensions and backup your file in
  • go to /tmp and extract libmemcached which you can download from the libmemcached website
  • go to the extracted directory named libmemcached-0.44 and install the library
tar -xvzf libmemcahed-0.44.tar.gz
cd libmemcached-0.44
./configure ; make
sudo make install
  • now, still being in /tmp, using pecl and phpize, download and install memcache
/usr/local/zend/bin/pecl download memcache
tar -xvzf memcache-2.2.6
cd memcache-2.2.6
#configure using the php-config of Zend Server AND forcing the architecture to 32bits as it is what was used to compile the ZendServer
./configure --with-php-config=/usr/local/zend/bin/php-config  MACOSX_DEPLOYMENT_TARGET=10.6 CFLAGS="-arch i386 -g -Os -pipe -no-cpp-precomp" CCFLAGS="-arch i386 -g -Os -pipe" CXXFLAGS="-arch i386 -g -Os -pipe" LDFLAGS="-arch i386 -bind_at_load"
sudo make install
  • Enable the extension in your php.ini by uncommenting the line
  • Restart Apache
/usr/local/zend/bin/apachectl restart
  • Go to a phpinfo page to make sure the extension memcache was installed

This should work for most extensions available in the PECL library.

External Links


Filed under: Computing, Mac OS X, PHP, Système

Tagged with: , , , , ,

Liked this page?

Tweet it

Subscribe to the RSS feed or sign up for the newsletter now.

Posts related to ZendServer Community Edition on Mac OS X: compiling PHP extensions

4 Comments to "ZendServer Community Edition on Mac OS X: compiling PHP extensions"

  1. Trackback on Samantha Halfon on January 29, 2011 at 3:53 pm

    New blog post: ZendServer Community Edition on Mac OS X: compiling PHP extensions: This post aims to explain how…

  2. Comment by Dmitry nelyakov on May 1, 2011 at 5:07 pm Reply

    Thanks a lot Samantha!

    I just wasted half of my day trying to install that memcache.
    You saved me the other half.

    Good luck.

  3. […] so as a 64-bit binary. However, Zend Server community edition is compiled using 32-bit. I found a blog post which explains exactly how to compile the PECL module. The solution worked out perfectly. This […]

  4. […] Schindler on “Compiling Gearman (or anything) for Zend Server CE on Snow Leopard”. And here is one more. Perhaps there is something different in the ‘./configure’ commands from […]

Name (required)

Email (required)


Leave a Reply

  • About Me

    photo of Samantha Halfon Samantha Halfon
    Software Engineer
    blueKiwi software
    Paris, France
    I enjoy playing with my computer(s), listening to Bob Dylan (and related artists) and watching movies (especially if they were directed by Martin Scorsese or John Cassavetes). Sometimes, I play a little guitar... If not doing any of the above, I am either riding a small red bike around Paris, or, making videos. About my videomaking please check out World Wide Angle and its blog.