Php – Troubles with memcache.so

lionmacmemcachememcachedPHP

I've been asked to launch a site that someone else built. It is a WordPress shop site that needs Memcached to run, and I've been having troubles getting Memcached and the memcache php plugin working on my local server. Before installing memcached and the memcache PHP plugin, I would get this error:

Fatal error: Class 'Memcache' not found in [Path]wp-content/object-cache.php on line 350

Now that I have memcached and the memcache PHP plugin installed (via Homebrew), I get a "No data received" page, and get this error in my Apache error log:

dyld: lazy symbol binding failed: Symbol not found: _mmc_queue_pop
  Referenced from: /usr/lib/php/extensions/no-debug-non-zts-20090626/memcache.so
  Expected in: flat namespace

dyld: Symbol not found: _mmc_queue_pop
  Referenced from: /usr/lib/php/extensions/no-debug-non-zts-20090626/memcache.so
  Expected in: flat namespace

[Sat May 05 16:38:27 2012] [notice] child pid 26491 exit signal Trace/BPT trap (5)

I've tried looking for that pid in Activity Monitor to no avail, and it changes every time I try to load the page. Also, I can't find anything about _mmc_queue_pop anywhere.

I'm running Mac OSX Lion, PHP ver 5.3.8, Memcached ver 1.4.13, and Memcache PHP plugin ver 3.0.6.

Does anyone know how I can fix this?

Thanks!

Best Answer

As David mentioned in the comments, when building the memcache plugin, NOT memcached itself, you have to add run configure like this:

MACOSX_DEPLOYMENT_TARGET=10.7 CFLAGS='-fgnu89-inline' LDFLAGS='-fgnu89-inline' CXXFLAGS='-fgnu89-inline' ./configure

That worked perfectly for me.