title: Installing mcrypt extension for PHP on OSX Mountain Lion
body: <p>Apologies in advance for the potential n00b questions, I am trying to install the mcrypt extension for PHP on my OSX Mountain Lion machine.</p>
  
  <p>The following steps in terminal is what I have done so far to achieve my PHP install</p>
  
  <pre><code>cd /path/to/downloaded/php-5.3.21/ext/mcrypt/
  /usr/bin/phpize
  ./configure
  cd /path/to/downloaded/php-5.3.21
  ./configure --with-config-file-path=/private/etc/php.ini --with-apxs2=/usr/sbin/apxs
  make
  sudo make install
  </code></pre>
  
  <p>Which seems to work well and installs PHP 5.3.21 fine. I have then done</p>
  
  <pre><code>sudo nano /private/etc/php.ini
  </code></pre>
  
  <p>And included</p>
  
  <pre><code>extension=mcrypt.so
  </code></pre>
  
  <p>Along with an Apache restart, phpinfo() doesn't show that the mcrypt extension is loaded.</p>
  
  <p>I then tried to specify the extension_dir inside php.ini, again with no luck. </p>
  
  <p>I have done</p>
  
  <pre><code>locate mcrypt.so
  /opt/local/lib/php/extensions/no-debug-non-zts-20090626/mcrypt.so
  /usr/local/Cellar/php53-mcrypt/5.3.18/mcrypt.so
  </code></pre>
  
  <p>And tried both directories as the extension_dir, with no luck.</p>
  
  <p>I have also tried the following, after much Googling</p>
  
  <pre><code>./configure --with-config-file-path=/private/etc/php.ini --with-apxs2=/usr/sbin/apxs --with-mcrypt
  </code></pre>
  
  <p>Which seems to work OK, but then upon "make", it returns</p>
  
  <pre><code>ext/mcrypt/mcrypt.o: No such file or directory
  ext/mcrypt/mcrypt_filter.o: No such file or directory
  </code></pre>
  
  <p>Again, no success.</p>
  
  <p>What am I doing wrong? It seems like the physical compile of mcrypt.so is not happening, or is compiling incorrectly as I would suspect there to be another mcrypt.so found under locate?</p>
  
  <p>Anyone please help? I've gone through pages upon pages of Google searches with no luck!</p>