Error installing php mongo driver after php5 upgrade - mongodb

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

Related

I couldn't upgrade my raspberry pi python version from 3.7 to 3.9

Please help me.
i have try out alot of way to get install, upgrade my python3.7 to python3.9 yet it keep shows up error.
sudo apt-get install python3
(Python3 is already the newest version [3.7.3-1])
sudo apt-get upgrade python3
(Python3 is already the newest version [3.7.3-1])
sudo add-apt-repository ppa:deadsnakes/ppa
(file "/user/bin/add-apt-repository", line 95, in )
(sp = SoftwareProperties(options=options)
(....)
(Error: could not find a distribution template for Raspbian/buster)
sudo apt-get install build-essential python-dev libsqlite3-dev libreadline6-dev libgdbm-dev zlib1g-dev libbz2-dev sqlite3 zip
(after install 2 newly package)
sudo apt-get install python3 python3-dev
(still back to python3.7)
anyone know how to make it to python3.9?
you have to type this in terminal:
sudo apt install python3.9
but you never can upgrade your Linux python to a newer version. It is internal.
but you can install python3.9 and use virtualenv to use your code in python3.9

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.

Error while installing Omnet++ on Ubuntu 16.04 : Cannot find osgEarth

I followed the installation guide and installed all the packages mentioned. However, I end up with this error message while running ./configure
checking for osgEarth with CFLAGS=" -fPIC -fno-stack-protector " LIBS=" -losgEarth -losgEarthUtil"... no
configure: error: Cannot find osgEarth 2.7 or later. Set WITH_OSGEARTH=no in configure.user to disable this feature or install an up to date version of osgEarth.
Here is a link to my config.log file : config.log
Cannot find osgEarth 2.7 or later
osgearth 2.7 for Ubuntu 16.04 → https://launchpad.net/~ubuntugis/+archive/ubuntu/ppa →
sudo add-apt-repository ppa:ubuntugis/ppa
sudo apt update
sudo apt install libosgearth-dev // you get "2.7"
// All prerequisites :
sudo apt install g++ libxml2-dev libosgearth-dev bison flex clang swig libqt5opengl5-dev qt5-qmake openjdk-8-jre libopenmpi-dev tcl8.5-dev tk8.5-dev
Installing the libgeos-dev package, and then editing the configure.user file in my OMnet++ source directory solved my problem.
$ sudo apt-get install libgeos-dev
Change the line #OSGEARTH_LIBS= to this:
OSGEARTH_LIBS=" -losgEarth -losgEarthUtil -lgeos_c "
Make sure to remove the # in the beginning.
Now run:
$ . setenv
$ ./configure
And it should work..
Others have also faced this problem before and have the fix mentioned here solved their issues:
http://gmt.soest.hawaii.edu/boards/1/topics/4621
https://trac.osgeo.org/postgis/changeset/11363
Answered by Attila Török on the omnetpp google group (omnetpp#googlegroups.com)

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

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

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