Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
I am trying to install a PHP MongoDB driver but the installation is failing because it cannot locate the OpenSSL.
/Users/username/mongo-php-driver/src/libmongoc/src/mongoc/mongoc-crypto-openssl.c:24:10: fatal error: 'openssl/sha.h' file not found
#include <openssl/sha.h>
1 error generated.
make: *** [src/libmongoc/src/mongoc/mongoc-crypto-openssl.lo] Error 1
I read that this has something to do with the latest version of MacOS? Is there a way to do it, as I really need to install this driver.
–
–
You’ll need to install OpenSSL using homebrew, and tell homebrew to create symlinks:
brew install openssl
brew link openssl --force
If you don’t already have homebrew installed, you can get it by running this:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
And before all that, if you haven’t already installed XCode and the XCode command-line tools:
xcode-select --install
–
–
–
Then run the following:
export LDFLAGS="-L/usr/local/opt/openssl/lib -L/usr/local/lib \
-L/usr/local/opt/expat/lib" && export CFLAGS="-I/usr/local/opt/openssl/include/ \
-I/usr/local/include -I/usr/local/opt/expat/include" && export \
CPPFLAGS="-I/usr/local/opt/openssl/include/ -I/usr/local/include \
-I/usr/local/opt/expat/include"
You can use environment variable C_INCLUDE_PATH
to tell the compiler to include the path to openssl header files.
For example, if you just want to do it once:
sudo C_INCLUDE_PATH=/usr/local/opt/openssl/include pecl install mongo
Thanks for contributing an answer to Stack Overflow!
Please be sure to answer the question. Provide details and share your research!
But avoid …
Asking for help, clarification, or responding to other answers.
Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.