title: PHP72 MongoDB driver with Homebrew on OSX
body: <p>I have a question that might point to a misunderstanding I have with Homebrew in relation to MongoDB:</p>
  
  <p>I am running XAMPP (version) with PHP 7.2.1 (which I want to use) on Mac OSX 10.12.6 (Sierra). I installed MongoDB and created configuration and data storage folder. It runs fine on command line (when using mongod and mongodb by terminal).</p>
  
  <p>Now, I want to install the PHP driver for PHP 7.2.1. I followed the instructions on <a href="http://php.net/manual/en/mongodb.installation.homebrew.php" rel="nofollow noreferrer">http://php.net/manual/en/mongodb.installation.homebrew.php</a>
  and adapted them to version 7.2, therefore:</p>
  
  <pre><code>$ brew tap homebrew/homebrew-php
  $ brew install php72-mongodb
  </code></pre>
  
  <p>this creates a php72 and a php72-mongodb folder in /usr/local/Cellar. However, my original (XAMPP based) PHP is in /Applications/XAMPP/ and the php there is in /Applications/XAMPP/etc/php.ini. </p>
  
  <p>and simply adding:</p>
  
  <pre><code>extension="/usr/local/opt/php72-mongodb/mongodb.so"
  </code></pre>
  
  <p>won't do the trick. After adding this extension, Apache won't start any more. /Applications/XAMPP/logs/php_error.log shows the following error:</p>
  
  <pre><code>[27-Feb-2018 13:11:59 UTC] PHP Warning:  
  PHP Startup: Unable to load dynamic library 'mongodb.so' 
  (tried: /Applications/XAMPP/xamppfiles/lib/php/extensions
  /no-debug-non-zts-20170718/mongodb.so 
  (dlopen(/Applications/XAMPP/xamppfiles/lib/php/extensions/
  no-debug-non-zts-20170718/mongodb.so, 9): image not found), 
  /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-
  20170718/mongodb.so.so 
  (dlopen(/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-
  non-zts-20170718/mongodb.so.so, 9): image not found)) in Unknown on 
  line 0
  </code></pre>
  
  <p>What is the correct way to include/connect the driver I just installed with my existing XAMPP installation? Do I need to tell Homebrew somehow where my XAMPP install is?</p>
  
  <p>Given that I also have a php folder in my Homebrew (and my /usr/local/opt folder) indicates that I have a second PHP installation right now. Is this the way it is supposed to be?</p>