title: Yosemite / El Capitan php-gd + mcrypt installation
body: <h3>How to install/enable <strong>php-gd</strong> and <strong>mcrypt</strong> in Yosemite 10.10 - PHP 5.5.14 build?</h3>
  
  <p><em>note that following steps install newest PHP 5.5.x</em></p>
  
  <p>To check if you have gd and mcrypt installed use <code>$ php -m</code> to display compiled in modules, continue if you are missing desired modules and please see <strong><a href="https://stackoverflow.com/a/26505558/1564365">accepted answer</a></strong>. </p>
  
  <hr>
  
  <h2>GD</h2>
  
  <blockquote>
    <p>So, Apple installed GD (and you're using their build of PHP, which is fine), but did not include support for PNG.</p>
  </blockquote>
  
  <p>You are definitely missing "full" <strong>gd (with png support)</strong> module if: 
  <a href="http://php.net/manual/en/function.imagecreatefrompng.php" rel="nofollow noreferrer">imagecreatefrompng()</a> function is missing.</p>
  
  <p><code>"Call to undefined function imagecreatefrompng()"</code></p>
  
  <p><img src="https://i.stack.imgur.com/0RAJY.png" alt="enter image description here"></p>
  
  <hr>
  
  <h2>Mcrypt</h2>
  
  <p>install brew using <strong><a href="https://stackoverflow.com/a/26505558/1564365">accepted answer</a></strong> and omit part with gd installation (unless you need it), and use following steps:</p>
  
  <ol>
  <li>do search - <code>$ brew search mcrypt</code></li>
  <li>pick the version of PHP you want</li>
  <li>install - <code>$ brew install php55-mcrypt</code></li>
  <li>confirm using <code>$ php -m | grep mcrypt</code></li>
  </ol>
  
  <hr>
  
  <h2>Want to switch between PHP versions?</h2>
  
  <p>Check out <a href="https://github.com/philcook/brew-php-switcher" rel="nofollow noreferrer">brew-php-switcher</a> and follow instructions.</p>