Hopefully I’ll save somebody days of work here. If you’re on a mac, unfortunately you can’t just run “pecl install memcache” (well you can, but it won’t work). I’m using Zend Server CE, which is a 32 bit application and if you run the above command to install from pecl, you’ll get a 64 bit version installed. Oh, and let’s be clear, we’re working with Memcache and not Memcached (they are very similar, but different).
OK, how to make it work. Open terminal and run the following commands –
- cd /tmp
- pecl download memcache
- tar xzf memcache-2.2.6.tgz (or whatever file and version you downloaded)
- cd memcache-2.2.6
- OK, here is a tricky one. Copy this line and change the path on the end to the location of your phpize executable and paste into terminal.
./configure MACOSX_DEPLOYMENT_TARGET=10.6 CFLAGS=’-O3 -fno-common -arch i386 -arch x86_64′ LDFLAGS=’-O3 -arch i386 -arch x86_64′ CXXFLAGS=’-O3 -fno-common -arch i386 -arch x86_64′ –with-php-config=/usr/local/zend/bin/php-config
- make install
Restart apache and you should be good to go.