title: Problems with installing mcrypt support for php54 using Homebrew on Mountain Lion
body: <p>I am trying to install mcrypt support in php 5.4.11 on Mountain Lion using Homebrew and I am getting problems I cannot resolve.</p>
  
  <p>I had already manually installed PHP 5.4.11 on my Mac. mcrypt had been previously installed using Homebrew.</p>
  
  <p>When I would load phpMyAdmin, it would tell me that mcrypt is not enabled.</p>
  
  <p>So, searching google, I realised that somehow, mcrypt was not being loaded as there was no reference to it when I loaded my phpinfo file.</p>
  
  <p>@DavidYell in a response to another question, <a href="https://stackoverflow.com/questions/14595841/installing-mcrypt-extension-for-php-on-osx-mountain-lion">Installing mcrypt extension for PHP on OSX Mountain Lion</a> suggested the following fix</p>
  
  <p><code>brew install mcrypt php53-mcrypt</code></p>
  
  <p>Below is the result of my issuing the command:</p>
  
  <pre><code>$ brew install mcrypt php54-mcrypt
  Error: mcrypt-2.5.8 already installed
  ==&gt; Installing php54-mcrypt dependency: autoconf
  ==&gt; Downloading http://ftpmirror.gnu.org/autoconf/autoconf-2.69.tar.gz
  ######################################################################## 100.0%
  ==&gt; ./configure --prefix=/usr/local/Cellar/autoconf/2.69
  ==&gt; make install
    /usr/local/Cellar/autoconf/2.69: 69 files, 2.0M, built in 29 seconds
  ==&gt; Installing php54-mcrypt dependency: freetype
  ==&gt; Downloading https://downloads.sf.net/project/machomebrew/Bottles/freetype-2.4.10.mountainlion.bottle.tar.gz
  ######################################################################## 100.0%
  ==&gt; Pouring freetype-2.4.10.mountainlion.bottle.tar.gz
    /usr/local/Cellar/freetype/2.4.10: 56 files, 2.5M
  ==&gt; Installing php54-mcrypt dependency: gettext
  ==&gt; Downloading https://downloads.sf.net/project/machomebrew/Bottles/gettext-0.18.2.mountain_lion.bottle.tar.gz
  ######################################################################## 100.0%
  ==&gt; Pouring gettext-0.18.2.mountain_lion.bottle.tar.gz
  ==&gt; Caveats
  This formula is keg-only: so it was not symlinked into /usr/local.
  
  OS X provides the BSD gettext library and some software gets confused if both are in the library path.
  
  Generally there are no consequences of this for you. If you build your
  own software and it requires this formula, you'll need to add to your
  build variables:
  
      LDFLAGS:  -L/usr/local/opt/gettext/lib
      CPPFLAGS: -I/usr/local/opt/gettext/include
  
  ==&gt; Summary
    /usr/local/Cellar/gettext/0.18.2: 366 files, 11M
  ==&gt; Installing php54-mcrypt dependency: libpng
  ==&gt; Downloading https://downloads.sf.net/project/machomebrew/Bottles/libpng-1.5.13.mountainlion.bottle.tar.gz
  ######################################################################## 100.0%
  ==&gt; Pouring libpng-1.5.13.mountainlion.bottle.tar.gz
    /usr/local/Cellar/libpng/1.5.13: 14 files, 1.0M
  ==&gt; Installing php54-mcrypt dependency: zlib
  ==&gt; Downloading http://zlib.net/zlib-1.2.7.tar.gz
  ######################################################################## 100.0%
  ==&gt; Patching
  patching file configure
  ==&gt; ./configure --prefix=/usr/local/Cellar/zlib/1.2.7
  ==&gt; make install
  ==&gt; Caveats
  This formula is keg-only: so it was not symlinked into /usr/local.
  
  Mac OS X already provides this software and installing another version in
  parallel can cause all kinds of trouble.
  
  Generally there are no consequences of this for you. If you build your
  own software and it requires this formula, you'll need to add to your
  build variables:
  
      LDFLAGS:  -L/usr/local/opt/zlib/lib
      CPPFLAGS: -I/usr/local/opt/zlib/include
  
  ==&gt; Summary
    /usr/local/Cellar/zlib/1.2.7: 9 files, 384K, built in 15 seconds
  ==&gt; Installing php54-mcrypt dependency: php54
  ==&gt; Downloading http://www.php.net/get/php-5.4.11.tar.bz2/from/this/mirror
  ######################################################################## 100.0%
  ==&gt; Downloading patches
  ######################################################################## 100.0%
  ==&gt; Patching
  patching file Makefile.global
  patch unexpectedly ends in middle of line
  ==&gt; ./configure --prefix=/usr/local/Cellar/php54/5.4.11 --localstatedir=/usr/local/var --sysconfdir=/usr/local/etc/php/5.4 --with-config-file-path=/usr/local/etc/php/5.4 --with-config-file-scan-dir=/usr/local/etc/php/5.4/conf.d --with-iconv-dir=/usr --enable-dba --with-ndbm=/usr --enable-exif --enable-soap --enable-w
  ==&gt; make
  ==&gt; make install
  ==&gt; /usr/local/Cellar/php54/5.4.11/bin/pear config-set php_ini /usr/local/etc/php/5.4/php.ini
  ==&gt; Caveats
  To enable PHP in Apache add the following to httpd.conf and restart Apache:
      LoadModule php5_module    /usr/local/Cellar/php54/5.4.11/libexec/apache2/libphp5.so
  
  The php.ini file can be found in:
      /usr/local/etc/php/5.4/php.ini
  
  ✩✩✩✩ PEAR ✩✩✩✩
  
  If PEAR complains about permissions, 'fix' the default PEAR permissions and config:
      chmod -R ug+w /usr/local/Cellar/php54/5.4.11/lib/php
      pear config-set php_ini /usr/local/etc/php/5.4/php.ini
  
  ✩✩✩✩ Extensions ✩✩✩✩
  
  If you are having issues with custom extension compiling, ensure that this php is
  in your PATH:
      PATH="$(brew --prefix josegonzalez/php/php54)/bin:$PATH"
  
  PHP54 Extensions will always be compiled against this PHP. Please install them
  using --without-homebrew-php to enable compiling against system PHP.
  ==&gt; Summary
    /usr/local/Cellar/php54/5.4.11: 485 files, 37M, built in 7.2 minutes
  ==&gt; Installing php54-mcrypt
  ==&gt; Downloading http://www.php.net/get/php-5.4.11.tar.bz2/from/this/mirror
  ######################################################################## 100.0%
  ==&gt; /usr/local/Cellar/php54/5.4.11/bin/phpize
  ==&gt; ./configure --prefix=/usr/local/Cellar/php54-mcrypt/5.4.11 --with-php-config=/usr/local/Cellar/php54/5.4.11/bin/php-config --with-mcrypt=/usr/local/Cellar
  ==&gt; make
  ==&gt; Caveats
  To finish installing mcrypt for PHP 5.4:
    * /usr/local/etc/php/5.4/conf.d/ext-mcrypt.ini was created,
      do not forget to remove it upon extension removal.
    * Restart your webserver.
    * Write a PHP page that calls "phpinfo();"
    * Load it in a browser and look for the info on the mcrypt module.
    * If you see it, you have been successful!
  ==&gt; Summary
    /usr/local/Cellar/php54-mcrypt/5.4.11: 3 files, 56K, built in 111 seconds
  </code></pre>
  
  <p>After restarting apache with <code>sudo apachectl restart</code> I reloaded phpinfo and still no mcrypt.</p>
  
  <p>Since php54-mcrypt was installed on the Homebrew installation of php, I went ahead and uninstalled it with <code>brew uninstall php54-mcrypt</code> and then reinstalled it using <code>brew install php54-mcrypt --without-homebrew-php</code>.</p>
  
  <p>Restarted apache and loaded phpinfo, and still no mcrypt.</p>
  
  <p>How do I fix this issue. I would be happy to just have homebrew install php, crypt, and phpmyadmin for me, but I can't seem to resolve this issue with my current setup, which was based on the advice found in <a href="http://mac.tutsplus.com/tutorials/server/upgrading-the-native-php-installation-on-os-x-mountain-lion/" rel="nofollow noreferrer">http://mac.tutsplus.com/tutorials/server/upgrading-the-native-php-installation-on-os-x-mountain-lion/</a>.</p>
  
  <p>Thanks.</p>