1

I'm trying to install memcache in my MAMP installation, using various ressources on the web.

I'm on Mac OS 10.10.3
MAMP 3.4
PHP 5.6.10
xCode installed

  • I installed memcache.so following https://github.com/majksner/php-memcached-mamp
  • I installed homebrew to install autoconf
  • Following https://stackoverflow.com/a/24392609/486529 :
    • I downloaded the PHP source on http://php.net/releases/
    • I created the folder /Applications/MAMP/bin/php/php5.X.X/include, and putted the downloaded folder in it.
    • I ran ./configure in /Applications/MAMP/bin/php/php5.X.X/include/php/
  • I ran ./pecl install memcache in /Applications/MAMP/bin/php/php5.X.X/bin/
  • I answered "no" to the question about session handler (I tryed yes, but something is missing, and not sure I need it)
  • When I restard MAMP, I get the following error :

    [28-Aug-2015 10:53:55 Europe/Berlin] PHP Warning: PHP Startup: Unable to load dynamic library '/Applications/MAMP/bin/php/php5.6.10/lib/php/extensions/no-debug-non-zts-20131226/memcached.so' - dlopen(/Applications/MAMP/bin/php/php5.6.10/lib/php/extensions/no-debug-non-zts-20131226/memcached.so, 9): Library not loaded: /usr/local/lib/libmemcached.11.dylib

    Referenced from: /Applications/MAMP/bin/php/php5.6.10/lib/php/extensions/no-debug-non-zts-20131226/memcached.so

    Reason: image not found in Unknown on line 0

What did I missed ? Is it necessary to change the PHP path ? (by now, which php returns /usr/bin/php and not the MAMP one)

Edit : I noticed I forgotted to install dependencies (following https://github.com/majksner/php-memcached-mamp) :

$ brew install memcached
$ brew install libmemcached

So now, the error on MAMP startup is gone, but when I try to use Memcache on a php script, I get the following error :

PHP Fatal error: Class 'Memcache' not found in /Applications/MAMP/htdocs/crm/application/core/MY_Controller.php on line 9

Edit 2 :

I'm stupid : I mixed memcache and memcached ! there are not the same !

So I just have to add extension=memcache.so in my php.ini to make it work !

Edit 3 : Don't forget to launch memcached server :

/usr/local/bin/memcached -d -m 512 -l 127.0.0.1 -p 11211

(I suppose I'll to do that at every restart, or put it somewhere for autostart)

Thanks a lot.

Community
  • 1
  • 1
Matthieu
  • 563
  • 1
  • 7
  • 25
  • I ve got confused.. Is it for memcache or memcached? – David Dec 05 '16 at 10:55
  • I must admit I'm confused too. But I think it IS confusing, because of the name similarity (look here http://stackoverflow.com/questions/17122655/im-confused-with-memcache-vs-memcached-vs-php5-memcache). So if I remember well I ended up using the memcache extension to connect to the memcached server. – Matthieu Dec 05 '16 at 14:47

0 Answers0