Ben Summerhayes
Ben Summerhayes

Reputation: 429

'openssl/evp.h' file not found OS x Mongodb

Having a mare with this. I'm trying to install the latest PHP mongo DB Drivers. I've looked everywhere and tried everything suggested but it will not get passed this error:


In file included from /private/tmp/pear/install/mongodb/src/contrib/php-ssl.c:31:
/private/tmp/pear/install/mongodb/src/contrib/php-ssl.h:33:10: fatal error: 'openssl/evp.h' file not found
include <openssl/evp.h>
         ^
1 error generated.
make: *** [src/contrib/php-ssl.lo] Error 1
ERROR: `make' failed

My system / setup:

OS X El Capitain v 10.11.6
PHP 7.1.0
Apache

I'm using this command to install it: sudo pecl install mongodb

I've tried the:

$ brew install openssl
$ brew link openssl --force

but that no longer works...and any of the latest workarounds for that do not work either

I've even tried going "rootless" but to no avail.

Upvotes: 11

Views: 11231

Answers (2)

Vijay Kumar Kanta
Vijay Kumar Kanta

Reputation: 1131

Two things are required. The one suggested by @ierdna was what was required for me to work, but only after I performed the following

~$ brew install openssl
~$ brew info openssl

Do the exporting as told by brew

~$ export LDFLAGS="-L/usr/local/opt/openssl/lib"
~$ export CPPFLAGS="-I/usr/local/opt/openssl/include"

Then do what ierdna tells you..

~$ cd /usr/local/include
~$ ln -s ../opt/openssl/include/openssl .

It worked for me immediately

Upvotes: 2

ierdna
ierdna

Reputation: 6293

This solution worked for me. If you don't already have openssl then first run brew install openssl. Then run:

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

Upvotes: 30

Related Questions