0

I just updated to Mac OS Sierra version 10.12.1 and executed

sudo pecl install mongodb

Installation failed and shows this message

Configure: error: Cannot find OpenSSL's <evp.h>
ERROR: `/private/tmp/pear/temp/mongodb/configure' failed

Also tried using Homebrew installation

brew install php56-mongo

but still mongo db php driver is not installed phpinfo() doesn't show the mongo extension.

Also tried with the solution provided here Using pecl to install the Mongodb driver on OS X El Capitan (v10.11.1)

when I try execute

brew install openssl 

Warning: openssl-1.0.2j already installed

and again when I execute brew link openssl --force it says

Warning: Refusing to link: openssl
Linking keg-only openssl means you may end up linking against the insecure,
deprecated system OpenSSL while using the headers from Homebrew's openssl.
Instead, pass the full include/library paths to your compiler e.g.:
  -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib

Any idea how to get it work?

Community
  • 1
  • 1
Ronak Shah
  • 450
  • 2
  • 9
  • 23
  • Also see [Brew refusing to link openssl](http://stackoverflow.com/q/38670295), [Update OpenSSL on OS X with Homebrew](http://stackoverflow.com/q/15185661), [How to install latest version of openssl Mac OS X El Capitan](http://stackoverflow.com/q/35129977), [How to upgrade OpenSSL in OS X?](http://apple.stackexchange.com/q/126830), [Openssl installation using HomeBrew fails](http://superuser.com/q/486389), etc. – jww Dec 03 '16 at 18:09

2 Answers2

1

You must first tap the PHP formula repository from terminal like so

brew tap homebrew/php

in order to install PHP extensions like MongoDB via Homebrew. After tapping the formula repository, install the MongoDB extension

brew install php56-mongo

In my case I had php56-mongo driver installed

After installation check the location of where mongo.so is located in file

/usr/local/etc/php/5.6/conf.d/ext-mongo.ini

Just Copy the location of mongo.so path

extension="/usr/local/opt/php56-mongo/mongo.so"

Add in php.ini and restart apache

sudo apachectl restart

Now Finally check the phpinfo() and it should show the mongo driver installed

Ronak Shah
  • 450
  • 2
  • 9
  • 23
0

I think you should install the "pkg-config" package as well. The PHP driver for MongoDB uses that to find out about OpenSSL.

Derick
  • 35,169
  • 5
  • 76
  • 99