0

When installing latest MongoDB library, following error is shown

pi@raspberrypi:~ $ composer require mongodb/mongodb
Using version ^1.2 for mongodb/mongodb
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
 Problem 1
 - Installation request for mongodb/mongodb ^1.2 -> satisfiable by mongodb/mongodb[1.2.0].
 - mongodb/mongodb 1.2.0 requires ext-mongodb ^1.3.0 -> the requested PHP extension mongodb is missing from your system.
 To enable extensions, verify that they are enabled in those .ini files:
 - /etc/php/7.0/cli/php.ini
 - /etc/php/7.0/cli/conf.d/10-mysqlnd.ini
 - /etc/php/7.0/cli/conf.d/10-opcache.ini
 - /etc/php/7.0/cli/conf.d/10-pdo.ini
 - /etc/php/7.0/cli/conf.d/15-xml.ini
 - /etc/php/7.0/cli/conf.d/20-bz2.ini
 - /etc/php/7.0/cli/conf.d/20-calendar.ini
 - /etc/php/7.0/cli/conf.d/20-ctype.ini
 - /etc/php/7.0/cli/conf.d/20-curl.ini
 - /etc/php/7.0/cli/conf.d/20-dom.ini
 - /etc/php/7.0/cli/conf.d/20-exif.ini
 - /etc/php/7.0/cli/conf.d/20-fileinfo.ini
 - /etc/php/7.0/cli/conf.d/20-ftp.ini
 - /etc/php/7.0/cli/conf.d/20-gd.ini
 - /etc/php/7.0/cli/conf.d/20-gettext.ini
 - /etc/php/7.0/cli/conf.d/20-iconv.ini
 - /etc/php/7.0/cli/conf.d/20-json.ini
 - /etc/php/7.0/cli/conf.d/20-mbstring.ini
 - /etc/php/7.0/cli/conf.d/20-mysqli.ini
 - /etc/php/7.0/cli/conf.d/20-pdo_mysql.ini
 - /etc/php/7.0/cli/conf.d/20-phar.ini
 - /etc/php/7.0/cli/conf.d/20-posix.ini
 - /etc/php/7.0/cli/conf.d/20-readline.ini
 - /etc/php/7.0/cli/conf.d/20-shmop.ini
 - /etc/php/7.0/cli/conf.d/20-simplexml.ini
 - /etc/php/7.0/cli/conf.d/20-sockets.ini
 - /etc/php/7.0/cli/conf.d/20-sysvmsg.ini
 - /etc/php/7.0/cli/conf.d/20-sysvsem.ini
 - /etc/php/7.0/cli/conf.d/20-sysvshm.ini
 - /etc/php/7.0/cli/conf.d/20-tokenizer.ini
 - /etc/php/7.0/cli/conf.d/20-wddx.ini
 - /etc/php/7.0/cli/conf.d/20-xmlreader.ini
 - /etc/php/7.0/cli/conf.d/20-xmlwriter.ini
 - /etc/php/7.0/cli/conf.d/20-xsl.ini
 - /etc/php/7.0/cli/conf.d/20-zip.ini
 You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Installation failed, reverting ./composer.json to its original content.
pi@raspberrypi:~ $

I have installed php developer library, installed pecl MongoDB dependencies and also updated php.ini file.

Steps I have use from the beginning.

  • sudo apt-get update
  • sudo apt-get upgrade
  • sudo apt-get install apache2 php mysql-server phpmyadmin mongodb-server this step installed MongoDB 2.4. MongoDB 3.x doesn't seem to work with ARM Chipset.
  • sudo apt-get install php7.0-dev (used this to remove phpize error)
  • sudo pecl install mongodb
  • Added extension=mongodb.so in php.ini file
  • composer require MongoDB/MongoDB
Aurora0001
6,3773 gold badges25 silver badges39 bronze badges
asked Jan 18, 2018 at 11:54
6
  • Could you edit to include the steps you used to install the compiled module for MongoDB and the output of php -i? Thanks. Commented Jan 18, 2018 at 15:20
  • please take a look @Aurora0001, I have added the details. Commented Jan 18, 2018 at 20:57
  • Thank you; could you include the output of php -i too? Commented Jan 18, 2018 at 20:58
  • It is working now, I don't know why, but first time editing php.ini file saved successfully, but not in actual. A reboot made it clear and solved the issue. Thanks :-) Commented Jan 18, 2018 at 21:20
  • No problem. Note that we don't encourage adding '[solved]' to your title here; instead, post your solution as an answer below and accept it to show that you resolved the issue. You might also gain some rep for your answer if it helps others! Commented Jan 19, 2018 at 13:43

2 Answers 2

1

The problem was with php.ini file, on 1st try, adding extension=mongodb.so and saving setting didn't save despite showing the change in the file on opening.

After a reboot of the system, I edited the file again and this time, it worked. I don't know why such thing happened and didn't save but it works fine now.

answered Feb 5, 2018 at 17:46
-2

try:

composer require mongodb/mongodb --ignore-platform-reqs
techraf
4,35310 gold badges33 silver badges43 bronze badges
answered Feb 1, 2018 at 7:06
1
  • Posting a single line of code without any explanation does not constitute as an answer. Since you are new to the site you should take the Tour to find out how things work around here. You might find this section How do I write a good answer? In the help center useful as well. Commented Feb 1, 2018 at 16:46

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.