title: How to install memcache in MAMP
body: <p>I'm trying to install memcache in my MAMP installation, using various ressources on the web.</p>
  
  <p>I'm on Mac OS 10.10.3<br>
  MAMP 3.4<br>
  PHP 5.6.10<br>
  xCode installed  </p>
  
  <ul>
  <li>I installed memcache.so following <a href="https://github.com/majksner/php-memcached-mamp" rel="nofollow noreferrer">https://github.com/majksner/php-memcached-mamp</a></li>
  <li>I installed homebrew to install autoconf</li>
  <li>Following <a href="https://stackoverflow.com/a/24392609/486529">https://stackoverflow.com/a/24392609/486529</a> :
  
  <ul>
  <li>I downloaded the PHP source on <a href="http://php.net/releases/" rel="nofollow noreferrer">http://php.net/releases/</a></li>
  <li>I created the folder /Applications/MAMP/bin/php/php5.X.X/include, and putted the downloaded folder in it.</li>
  <li>I ran ./configure in /Applications/MAMP/bin/php/php5.X.X/include/php/</li>
  </ul></li>
  <li>I ran ./pecl install memcache in /Applications/MAMP/bin/php/php5.X.X/bin/</li>
  <li>I answered "no" to the question about session handler (I tryed yes, but something is missing, and not sure I need it)</li>
  <li><p>When I restard MAMP, I get the following error :</p>
  
  <blockquote>
    <p>[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</p>
    
    <p>Referenced from: /Applications/MAMP/bin/php/php5.6.10/lib/php/extensions/no-debug-non-zts-20131226/memcached.so</p>
    
    <p>Reason: image not found in Unknown on line 0</p>
  </blockquote></li>
  </ul>
  
  <p>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)</p>
  
  <p>Edit : I noticed I forgotted to install dependencies (following <a href="https://github.com/majksner/php-memcached-mamp" rel="nofollow noreferrer">https://github.com/majksner/php-memcached-mamp</a>) :</p>
  
  <pre><code>$ brew install memcached
  $ brew install libmemcached
  </code></pre>
  
  <p>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 :</p>
  
  <blockquote>
    <p>PHP Fatal error:  Class 'Memcache' not found in /Applications/MAMP/htdocs/crm/application/core/MY_Controller.php on line 9</p>
  </blockquote>
  
  <p>Edit 2 :</p>
  
  <p>I'm stupid : I mixed memcache and memcached ! there are not the same !</p>
  
  <p>So I just have to add extension=memcache.so in my php.ini to make it work !</p>
  
  <p>Edit 3 :
  Don't forget to launch memcached server :</p>
  
  <pre><code>/usr/local/bin/memcached -d -m 512 -l 127.0.0.1 -p 11211
  </code></pre>
  
  <p>(I suppose I'll to do that at every restart, or put it somewhere for autostart)</p>
  
  <p>Thanks a lot.</p>