[PHP] PHP7-MongoDB 드라이버 에러 - PHP Fatal error: Uncaught MongoDB\Driver\Exception\AuthenticationException: The “SCRAM-SHA-1” authentication mechanism requires libmongoc built with –enable-ssl
PHP 2019. 2. 21. 10:10PHP7-MongoDB 드라이버(https://pecl.php.net/package/mongodb)를 아래처럼 일반적인 과정으로 설치
phpize
./configure
make
make install
막상 PHP에서 사용하려 하자 아래와 같은 에러 발생
PHP Fatal error: Uncaught MongoDB\Driver\Exception\AuthenticationException: The “SCRAM-SHA-1” authentication mechanism requires libmongoc built with –enable-ssl
phpinfo()에 보면 libmongoc SSL이 disabled로 되어 있음
[root@localhost]# php -i | grep libmongoc
libmongoc bundled version => 1.13.0
libmongoc SSL => disabled
libmongoc crypto => disabled
libmongoc SASL => disabled
libmongoc ICU => enabled
libmongoc compression => enabled
libmongoc compression snappy => disabled
libmongoc compression zlib => enabled
이 문제를 해결하려면 ./configure 실행시 --with-mongodb-ssl 옵션을 줘야함
그 전에 openssl-devel 패키지가 설치되어 있는지 확인해볼 것
// 1. openssl-devel 설치
[root@localhost]# yum install -y openssl-devel
// 2. ./configure 에 옵션을 주고 다시 빌드
[root@localhost]# phpize
[root@localhost]# ./configure --with-mongodb-ssl
[root@localhost]# make
[root@localhost]# make install
// 확인
[root@localhost]# php -i | grep libmongoc
libmongoc bundled version => 1.13.0
libmongoc SSL => enabled
libmongoc SSL library => OpenSSL
libmongoc crypto => enabled
libmongoc crypto library => libcrypto
libmongoc crypto system profile => disabled
libmongoc SASL => disabled
libmongoc ICU => enabled
libmongoc compression => enabled
libmongoc compression snappy => disabled
libmongoc compression zlib => enabled