Error to install mongodb in lumen - mongodb

I use Lumen micro framework on ubuntu 14.4,when i want to install monogodb packege form this link i got a error like below:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- jenssegers/mongodb v3.0.0 requires mongodb/mongodb ^1.0.0 -> satisfiable by mongodb/mongodb[1.0.0, 1.0.1].
- jenssegers/mongodb v3.0.1 requires mongodb/mongodb ^1.0.0 -> satisfiable by mongodb/mongodb[1.0.0, 1.0.1].
- jenssegers/mongodb v3.0.2 requires mongodb/mongodb ^1.0.0 -> satisfiable by mongodb/mongodb[1.0.0, 1.0.1].
- 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 jenssegers/mongodb ^3.0 -> satisfiable by jenssegers/mongodb[v3.0.0, v3.0.1, v3.0.2].
To enable extensions, verify that they are enabled in those .ini files:
- /etc/php5/cli/php.ini
- /etc/php5/cli/conf.d/05-opcache.ini
- /etc/php5/cli/conf.d/10-pdo.ini
- /etc/php5/cli/conf.d/20-curl.ini
- /etc/php5/cli/conf.d/20-gd.ini
- /etc/php5/cli/conf.d/20-json.ini
- /etc/php5/cli/conf.d/20-mcrypt.ini
- /etc/php5/cli/conf.d/20-mysql.ini
- /etc/php5/cli/conf.d/20-mysqli.ini
- /etc/php5/cli/conf.d/20-pdo_mysql.ini
- /etc/php5/cli/conf.d/20-readline.ini
- /etc/php5/cli/conf.d/mongo.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.
How can i fix it?

You don't have the php mongodb driver/extension installed
use this
sudo apt-get install php5-mongo
if you are on php 5

When i run php -m i got :
amirali#amirali-U30J:~$ php -m
PHP Warning: Module 'mongo' already loaded in Unknown on line 0
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dba
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
json
libxml
mbstring
mcrypt
mhash
mongo
mysql
mysqli
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
Zend OPcache
zip
zlib
[Zend Modules]
Zend OPcache

Use pecl instead.
pecl install mongodb
See here.

Related

how to fix issue when magento upgrade from 2.3.4 to 2.4.3?

I'd like to upgrade magento from 2.3.4 to 2.4.3.
But I cannot upgrade it.
this is error.
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires magento/product-community-edition 2.4.3 -> satisfiable by magento/product-community-edition[2.4.3].
- magento/product-community-edition 2.4.3 requires php ~7.3.0||~7.4.0 -> your php version (7.2.34) does not satisfy that requirement.
Problem 2
- Root composer.json requires dealerdirect/phpcodesniffer-composer-installer ^0.5.0 -> satisfiable by dealerdirect/phpcodesniffer-composer-installer[v0.5.0].
- dealerdirect/phpcodesniffer-composer-installer v0.5.0 requires composer-plugin-api ^1.0 -> found composer-plugin-api[2.2.0] but it does not match the constraint.
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
I am using cpanel now. In cpanel I set php version is 7.4
PHP 7.4.33 (cli) (built: Nov 10 2022 11:12:07) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.33, Copyright (c), by Zend Technologies
what is the reason?
See if you're really using php 7.4 by typing php -v in the terminal. When you are sure that your php version is correct, delete the composer.lock file (make a backup beforehand). Try updating with the command:
composer require magento/product-community-edition:2.4.5 -W
If that doesn't work, post the contents of the composer.json file
If you are migrating from 2.3.4 to 2.4.3, you need to make the following and please follow these below steps:
1: Backup composer.json: Run the command
cp composer.json composer.json.bak
2: Upgrade your Magento: Run the commmand
composer require-commerce magento/<product> <version> --no-update [--interactive-root-conflicts] [--force-root-updates] [--help]
3: Update the dependecies:
composer update
For example, Specify the metapackage:
Magento Open Source: composer require-commerce magento/product-community-edition 2.4.4 --no-update
Adobe Commerce: composer require-commerce magento/product-enterprise-edition 2.4.4 --no-update
4: Composer Update: Run composer update
5: Update the database schema and data. bin/magento setup:upgrade
6: Disable Magento maintenance mode. bin/magento maintenance:disable
7: Restart Varnish. (Optional) Restart Varnish If you use it for page caching: service varnish restart
Please switch to PHP 7.4 first then check perform the upgrade.

How to install mongodb-odm on symfony4 with php 7.3 (Windows 10)?

I am trying to install mongodb-odm on symfony4 (php 7.3), but getting those problems
Problem 1
- doctrine/mongodb-odm 2.0.5 requires ext-mongodb ^1.5 -> the requested PHP extension mongodb is missing from your system.
- doctrine/mongodb-odm 2.0.4 requires ext-mongodb ^1.5 -> the requested PHP extension mongodb is missing from your system.
- doctrine/mongodb-odm 2.0.3 requires ext-mongodb ^1.5 -> the requested PHP extension mongodb is missing from your system.
- doctrine/mongodb-odm 2.0.2 requires ext-mongodb ^1.5 -> the requested PHP extension mongodb is missing from your system.
- doctrine/mongodb-odm 2.0.1 requires ext-mongodb ^1.5 -> the requested PHP extension mongodb is missing from your system.
- doctrine/mongodb-odm 2.0.0 requires ext-mongodb ^1.5 -> the requested PHP extension mongodb is missing from your system.
- Installation request for doctrine/mongodb-odm ^2.0 -> satisfiable by doctrine/mongodb-odm[2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5].
When I try to install composer require mongodb/mongodb I'm getting
Problem 1
- Installation request for mongodb/mongodb ^1.6 -> satisfiable by mongodb/mongodb[1.6.0].
- mongodb/mongodb 1.6.0 requires ext-mongodb ^1.7 -> the requested PHP extension mongodb is missing from your system.
I see in phpinfo(); that mongodb is installed (MongoDB extension version 1.7.2), but when I type php -m, I don't see mongo there.

Install mongodb on mac os 10.15 for php7

I have installed mongodb on my mac Catalina 10.15. I have php7.3 version installed as well. Now, I want to use the mongoClient() class with PHP. I tried composer require mongodb/mongodb but it says that the mongodb extension is missing :
Using version ^1.5 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
- mongodb/mongodb 1.5.1 requires ext-mongodb ^1.6 -> the requested PHP extension mongodb is missing from your system.
- mongodb/mongodb 1.5.0 requires ext-mongodb ^1.6 -> the requested PHP extension mongodb is missing from your system.
- Installation request for mongodb/mongodb ^1.5 -> satisfiable by mongodb/mongodb[1.5.0, 1.5.1].
To enable extensions, verify that they are enabled in your .ini files:
- /etc/php.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.
So I tried to install the extension for php using the php doc and I get this error :
pear/install/mongodb/php_phongo.c -fno-common -DPIC -o .libs/php_phongo.o
/private/tmp/pear/install/mongodb/php_phongo.c:22:10: fatal error: 'php.h' file not found
#include <php.h>
^~~~~~~
1 error generated.
make: *** [php_phongo.lo] Error 1
ERROR: `make' failed
Any help ?
I also had the same issue after upgrading to MacOS Catalina
Run these two commands;
brew doctor
brew link --overwrite php
I fixed that by installing PHP7.3 using homebrew
here is a post that helped Install PHP 7.3 + xdebug on MacOS Catalina (with homebrew)
I also updated the macos to 10.15 catalina and started the setup. As same as error came during installing the mongodb driver
After Resolving my issue I updated the answer by given below steps:
Step 1:
Run the command: brew install php71
Step 2:
Edit httpd.conf under directory of /etc/apache2/httpd.conf
Add below line
LoadModule php7_module /usr/local/opt/php#7.1/lib/httpd/modules/libphp7.so
then check there should be no other php7_module enabled.
Also add these lines
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
Step 3: Restart apache: sudo apachectl restart
Step 4:
If you need to have php#7.1 first in your PATH run:
echo 'export PATH="/usr/local/opt/php#7.1/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/php#7.1/sbin:$PATH"' >> ~/.bash_profile
For compilers to find php#7.1 you may need to set:
export LDFLAGS="-L/usr/local/opt/php#7.1/lib"
export CPPFLAGS="-I/usr/local/opt/php#7.1/include"
Step 5:
To have launched start php#7.1 now and restart at login:
brew services start php#7.1
Step 6:
Open new terminal & check php version & it should be 7.1
Step 7:
Then run the command: sudo pecl install MongoDB
& it will install php mongodb driver successfully without any error.
Make sure all step should be followed!!
I did these steps to resolve my MongoDB driver issue for laravel project which not found.

How install PHP extension mongodb on MAMP

I installed yii2, composer and MAMP
but when i do composer update i have error
- yiisoft/yii2-mongodb 2.1.7 requires ext-mongodb >=1.0.0 -> the requested PHP extension mongodb is missing from your system.
- yiisoft/yii2-mongodb 2.1.6 requires ext-mongodb >=1.0.0 -> the requested PHP extension mongodb is missing from your system.
- yiisoft/yii2-mongodb 2.1.5 requires ext-mongodb >=1.0.0 -> the requested PHP extension mongodb is missing from your system.
- yiisoft/yii2-mongodb 2.1.4 requires ext-mongodb >=1.0.0 -> the requested PHP extension mongodb is missing from your system.
- yiisoft/yii2-mongodb 2.1.3 requires ext-mongodb >=1.0.0 -> the requested PHP extension mongodb is missing from your system.
- yiisoft/yii2-mongodb 2.1.2 requires ext-mongodb >=1.0.0 -> the requested PHP extension mongodb is missing from your system.
- yiisoft/yii2-mongodb 2.1.1 requires ext-mongodb >=1.0.0 -> the requested PHP extension mongodb is missing from your system.
- yiisoft/yii2-mongodb 2.1.0 requires ext-mongodb >=1.0.0 -> the requested PHP extension mongodb is missing from your system.
- Installation request for yiisoft/yii2-mongodb ^2.1 -> satisfiable by yiisoft/yii2-mongodb[2.1.0, 2.1.1, 2.1.2, 2.1.3, 2.1.4, 2.1.5, 2.1.6, 2.1.7].
I surfed the entire Internet and did not find a solution
to mongodb extension install do
sudo apt-get install php-mongodb

Trying to install mongo-php-adater for mongodb use with symfony4 issue

I am trying to install mongo-php-adapter to use mongoDB with Symfony 4, but I have the following problem:
Problem 1
    - alcaeus/mongo-php-adapter 1.1.6 requires ext-mongodb ^1.2.0 -> the requested PHP extension mongodb is missing from your system.
    - alcaeus/mongo-php-adapter 1.1.5 requires ext-mongodb ^1.2.0 -> the requested PHP extension mongodb is missing from your system.
    - alcaeus/mongo-php-adapter 1.1.4 requires ext-mongodb ^1.2.0 -> the requested PHP extension mongodb is missing from your system.
    - alcaeus/mongo-php-adapter 1.1.3 requires ext-mongodb ^1.2.0 -> the requested PHP extension mongodb is missing from your system.
    - alcaeus/mongo-php-adapter 1.1.2 requires ext-mongodb ^1.2.0 -> the requested PHP extension mongodb is missing from your system.
    - alcaeus/mongo-php-adapter 1.1.1 requires ext-mongodb ^1.2.0 -> the requested PHP extension mongodb is missing from your system.
    - alcaeus/mongo-php-adapter 1.1.0 requires ext-mongodb ^1.2.0 -> the requested PHP extension mongodb is missing from your system.
    - Installation request for alcaeus/mongo-php-adapter ^1.1 -> satisfiable by alcaeus/mongo-php-adapter[1.1.0, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.1.5, 1.1.6].
 
  To enable extensions, verify that they are enabled in your .ini files:
    - /opt/lampp/etc/php.ini
  You can also run php --ini inside terminal to see which files are used by PHP in CLI mode.
I installed php-mongo and put extension=mongodb.so in the php.ini file but it doesn't change anything on the contrary it says it can't find the mongodb.so file.
I also installed mongodb with pecl but still the same problem.
Thank you in advance for your help