The "SCRAM-SHA-1" authentication mechanism requires libmongoc built with --enable-ssl - mongodb

Getting error message while connecting to database using Laravel 5.4 and Mongodb 3.6
The "SCRAM-SHA-1" authentication mechanism requires libmongoc built with --enable-ssl
Its running fine in ubuntu 16.04 with same versions, but not in AWS Linux.
Installed LAMP [ php70, apach24 ] :
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-LAMP.html
Installed Mongodb [ 3.6 ] :
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-amazon/
Installed php-mongodb driver for php7:
sudo yum -y install php7-pear php70-devel gcc // completed
sudo pecl7 install mongodb // completed
sudo yum install openssl-devel // completed
php-mongodb driver installed and updated to php.ini, mongodb shows in phpinfo() as well.
we find there is libmongoc ssl disabled from phpinfo, Is that issue ?
How can we enable it ?

On Ubuntu 18.04 LTS, PHP 7.2.7
I had to install some extra packages:
sudo apt-get install -y libcurl4-openssl-dev pkg-config libssl-dev
Then re-install mongodb:
sudo pecl uninstall mongodb
sudo pecl install mongodb
Then check that SSL is enabled:
php -i | grep mongo
/etc/php/7.2/cli/conf.d/20-mongodb.ini,
mongodb
libmongoc bundled version => 1.11.0
libmongoc SSL => enabled
libmongoc SSL library => OpenSSL
libmongoc crypto => enabled
libmongoc crypto library => libcrypto
Restart php:
sudo service php7.2-fpm restart

Error, because of disabled libmongoc SSL and libmongoc Crypto from php-mongodb driver and enabled by following command.
sudo pecl7 config-set php_ini /etc/php.ini
After installing mongodb driver sudo pecl7 install mongodb, we should set the above.
now runs fine.

For those who have the error on an Alpine docker. You must add in your Dockerfile :
RUN apk add curl-dev openssl-dev
instead of sudo apt-get install -y libcurl4-openssl-dev pkg-config libssl-dev
I used RUN pecl config-set php_ini /etc/php.ini too

I get the same message using docker. I add to my Docker file
apt-get install -y libcurl4-openssl-dev pkg-config libssl-dev
and run
docker-compose up -d --build

Here is how I solved in CentOS 7
Remove mongodb extension:
pecl uninstall mongodb
Install openssl
sudo yum install openssl-devel
Reinstall MongoDB extension again
pecl install mongodb

On my Debian 9 module compillation fails with following error:
configure: error: OpenSSL libraries and development headers could not
be found
If you have same error try following:
apt-get remove libssl-dev
apt-get install libssl1.0-dev

As for me, this command does everything on Debian 9 and php 7.0
sudo apt-get install php-mongodb
Just restart Apache2 service afterwards

Related

The following packages have unmet dependencies: mongodb-org :

I am trying to install Mongodb using the command sudo apt-get install -y mongodb-org on ubuntu 16.04 after it produces the following error:
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
mongodb-org : Depends: mongodb-org-shell but it is not going to be installed
Depends: mongodb-org-server but it is not going to be installed
Depends: mongodb-org-mongos but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Looking at the MongoDB Documentation at https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/ it says to use their package not the Ubuntu APT package.
Here are the steps to use the MongoDB Package in a nutshell...
Add the APT Key:
wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
Add the APT Sources List:
echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list
Update APT:
sudo apt-get update
Install the MongoDB Community Edition Package:
sudo apt-get install -y mongodb-org
Start the service:
sudo service mongod start
Log into the database using mongoshell:
mongo
If someone else struggle with this issue and all the other answers didn't work...
This is what work for me:
apt-get install mongodb-org-shell
apt-get install mongodb-org-server
apt-get install mongodb-org-mongos
And then again
sudo apt-get install -y mongodb-org
Detials (run uname -a):
Linux resta-dev 4.15.0-66-generic #75-Ubuntu SMP Tue Oct 1 05:24:09 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
I got this issue when the wrong Ubuntu version was selected. Make sure you double check that you run the correct one.
Your system already had the Ubuntu MongoDB package installed prior to installing the official mongodb-org packages. To confirm whether the host has the Ubuntu mongodb package installed, run;
sudo apt list --installed | grep mongo
If present you will need to remove all the installed mongodb-org packages by running;
sudo apt remove mongo*
Once all the MongoDB packages are removed you can now use the Official installation Guide to complete your installation
Use this command to display the installed applications and their dependencies causing troubles:
sudo dpkg --configure -a
and use the following command and replace package-name with the name of the package that need to be removed
sudo dpkg --remove package-name
You are now good to go.

Unable to install rdkafka on Ubuntu 16.04

I want to install rdkafka
Upon running the command as per the instructions: sudo pecl install rdkafka
I have installed pecl using the command:
sudo apt-get install php-pear php-dev
Quick Install Steps:
Step 1 Install PHP pecl and pear commands:
sudo apt install php-pear
Step 2 Install librdkafka
sudo apt-get install -y librdkafka-dev
Step 3 Install PECL-package
sudo pecl install rdkafka
Step4 Enable PHP-extension in PHP config. Add to php.ini
extension=rdkafka.so
Step 4 Restart apache server
sudo service apache2 restart
Before doing that install librdkafka . linux command sudo apt-get install librdkafka . After that try the same command as you mentioned using pecl. Hope it should work.
For more detail use this link: https://arnaud-lb.github.io/php-rdkafka/phpdoc/book.rdkafka.html

composer does not install mongodb ubuntu

I ran: composer require mongodb/mongodb. But it gave me the following error :
has error:
- mongodb/mongodb 1.0.1 requires ext-mongodb ^1.1.0 -> the requested PHP extension mongodb is missing from your system.
- mongodb/mongodb 1.0.0 requires ext-mongodb ^1.1.0 -> the requested PHP extension mongodb is missing from your system.
- Installation request for mongodb/mongodb ^1.0 -> satisfiable by mongodb/mongodb[1.0.0, 1.0.1].
I tried : composer show -p
Then it gave me:
......
ext-iconv 0 The iconv PHP extension
ext-mcrypt 0 The mcrypt PHP extension
ext-mhash 0 The mhash PHP extension
ext-mongo 1.6.12 The mongo PHP extension
ext-mysql 1.0 The mysql PHP extension
ext-mysqli 0.1 The mysqli PHP extension
......
Why am I getting the error?
php -m
.....
libxml
mbstring
mcrypt
mhash
mongo
mysql
mysqli
openssl
pcntl
pcre
PDO
.....
I'm using ubuntu 14.04 LTS
Install the php driver $ sudo pecl install mongodb
Create the extension file $ sudo nano /etc/php/*version*/mods-available/mongodb.ini and write inside: extension=mongodb.so
Create a symbolic link for this file $ sudo ln -sv /etc/php/*version*/mods-available/mongodb.ini /etc/php/*version*/apache2/conf.d/20-mongodb.ini
Create an other symbolic link for this file $ sudo ln -sv /etc/php/*version*/mods-available/mongodb.ini /etc/php/*version*/cli/conf.d/20-mongodb.ini
Restart apache or the server used $ sudo service apache2 restart
It may be necessary to reinstall jenssegers/mongodb: $ composer require jenssegers/mongodb
for quick and easy, just do:
sudo pecl install mongodb
sudo nano /etc/php5/apache2/php.ini, add (at bottom or wherever):
; mongodb
extension=mongodb.so
sudo nano /etc/php5/cli/php.ini, add (at bottom or wherever):
; mongodb
extension=mongodb.so
restart webserver for good measure (not necessary for cli): sudo service apache2 restart
i'm run:
sudo apt-get install libpcre3-dev
then:
pecl install mongodb
and add: extension=mongodb.so to bottom line of cli/php.ini

Error installing php mongo driver after php5 upgrade

I upgraded my php5 version from 5.4 to 5.6 this way (debian 7.9) :
I added
deb http://packages.dotdeb.org wheezy-php56 all
deb-src http://packages.dotdeb.org wheezy-php56 all
to my /etc/apt/source.list file, and then :
apt-get update
apt-get install php5
All is running fine :
php --version
PHP 5.6.16-1
But i need to upgrade my php mongodb driver, and i got the following error :
pecl install mongodb
331 source files, building
running: phpize
Configuring for:
PHP Api Version: 20131106
Zend Module Api No: 20131226
Zend Extension Api No: 220131226
building in /tmp/pear/temp/pear-build-rootmStnQj/mongodb-1.0.0
running: /tmp/pear/temp/mongodb/configure --with-php-config=/usr/bin/php-config
[...]
checking for pkg-config... no
configure: error: Cannot find OpenSSL's libraries
ERROR: `/tmp/pear/temp/mongodb/configure --with-php-config=/usr/bin/php-config' failed
I have openssl and libssl-dev installed.
Any idea ?
I had same problem and following command worked for me.
apt-get install pkg-config
I had the same error. I installed the following dependencies before installing mongodb
sudo apt-get install -y autoconf g++ make openssl libssl-dev libcurl4-openssl-dev pkg-config libsasl2-dev libpcre3-dev
sudo pecl install mongodb

MongoDB - Ubuntu 15.04 missing packages

I've updated my Ubuntu 14.04 to the latest 15.04. Since then Mongo failed to run. can run the command mongo and it'll advise the version and so on but server will not run: sudo service mongod start as normal.
When I ran: sudo apt-get install -y mongodb-org it failed with the error in the screen shot below:
I completely purged mongo and re-installed, followed the instructions from here. However when I ran sudo apt-get update I noticed the below packages were 404'ing. See Screen shot below.
If anyone could shed any light on this would be great?
Following instructions from this page page http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
but with slighty changed second step 2. Create a list file for MongoDB:
echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
I put trusty (code name for Ubuntu 14.04 LTS) instead of $(lsb_release -sc) which issues vivid as codename for 15.04
I see now that #Nail Lonergan already commented echo path change...
There is currently no build available for Ubuntu 15.04. Check this page for all builds: https://www.mongodb.org/downloads#development
After having heaps of issues, finally this is how I installed it,
Ubuntu 15.04
apt-get update
apt-get dist-upgrade
apt-get install -y mongodb
sudo apt-get install upstart-sysv
sudo service mongodb status
if not running
sudo service mongodb start
Install PHP Driver
sudo apt-get install php5-dev
sudo apt-get install build-essential
sudo pecl install mongo
https://sonnguyen.ws/install-mongodb-mongo-php-in-ubuntu/
sudo apt-get install mongodb
ps -ef|grep mongo
sudo pecl install mongo
sudo apt-get install php5-dev php5-cli php-pear