Using pecl to install the Mongodb driver on OS X El Capitan (v10.11.1)

I am trying to install the php mongo driver for OS X. I tried to follow these instructions to no avail.

$ which pecl/usr/local/Cellar/php56/5.6.13_2/bin/pecl

$ sudo pecl install mongo full build results here , but the problem is the error:

 In file included from /private/tmp/pear/install/mongo/io_stream.c:34: /private/tmp/pear/install/mongo/contrib/php-ssl.h:33:10: fatal error: 'openssl/evp.h' file not found #include <openssl/evp.h> 

My Xcode command line tools are updated (I used $ xcode-select --install ).

I am sure how to solve this problem.

+6
source share
4 answers

I managed to get around this by installing OpenSSL using Homebrew ( as suggested here ):

 $ brew install openssl $ brew link openssl --force 

Then

 $ sudo pecl install mongodb 
+15
source

Do it

 $ cd /usr/local/include $ ln -s ../opt/openssl/include/openssl 
+6
source

I recommend using http://phpbrew.imtqy.com/phpbrew/ for this type of thing. This allows you to easily install any extensions into any required php version.

When installing a new version of php, I usually follow the log during compilation. There may be dependencies that need to be installed first. Also, make sure you have an updated version of homebrew installed.

+1
source

You need to disable the mechanism without the Mac OSX El Capitán roots:

  • Download from Cmd-R
  • Open terminal
  • Type csrutil disable
  • Reboot

On Mac, you need to install Xcode, and create a symlink for openssl comes with Xcode, i.e.

 cd /usr/include; sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdk/MacOSX.sdk/usr/include/openssl 
-1
source

All Articles