MacOS – XAMPP on Mavericks install APC and Memcached

apachemacosPHP

What I already did:

  • Download latest stable release from pecl.php.net with wget-
  • Unpack archive
  • Run phpize, ./configure, make, make install, etc..

That stuff went well, now I have:

/usr/lib/php/extensions/no-debug-non-zts-20100525/apc.so
/usr/lib/php/extensions/no-debug-non-zts-20100525/memcached.so

In my php.ini (Loaded Configuration File from phpinfo) I added:

extension_dir="/usr/lib/php/extensions/no-debug-non-zts-20100525/"
extension=memcached.so
extension=apc.so

But the problem is, the libraries are not beeing loaded, the correspondent sections in phpinfo() are missing.
I have tried to:

  • Restart apache
  • Comment out "extension_dir"
  • Use "zend_extension" instead of "extension"
  • Specify the full path to the .so files

Restart of XAMPP happens without problems, no error log is generated.
Anyone of you have an idea what could be wrong here?

Best Answer

If you've installed XAMPP then you'll have two versions of PHP on your system. I think the problem is that you are using the XAMPP version of PHP, but the extensions have been compiled against the OS bundled version.

If you are using XAMPP then you'll need to use the toolchain that comes with XAMPP. For example, try sudo /Applications/XAMPP/xamppfiles/bin/pecl install memcached, this seems to download, build and install memcached correctly for me so that XAMPP can use it.

After that I just needed to add the extension=memcached.so line to php.ini and now memcached is appearing in phpinfo().