I'm stuck with a problem of MongoDb installation. I'm working with Symfony 6 and PHP 8.1, and i would like integrate in my application mongoDB. I've downloaded the mongoDB image on Docker, and all is working.
The problem
Now, i need to use doctrine for MongoDB. So, follow the documentation , i run composer require doctrine/mongodb-odm-bundle
and also composer require doctrine/mongodb-odm
. For the first command, i get the following errors:
Problem 1 - doctrine/mongodb-odm-bundle[4.3.0, ..., 4.3.1] require doctrine/persistence ^1.3.6|^2.0 -> found doctrine/persistence[1.3.6, 1.3.7, 1.3.8, 2.0.0, ..., 2.5.7] but it conflicts with your root composer.json require (^3.1).
- doctrine/mongodb-odm-bundle[4.4.0, ..., 4.5.2] require ext-mongodb ^1.5 -> it is missing from your system. Install or enable PHP's mongodb extension. - Root composer.json requires doctrine/mongodb-odm-bundle ^4.3 -> satisfiable by doctrine/mongodb-odm-bundle[4.3.0, ..., 4.5.2]. To enable extensions, verify that they are enabled in your .ini files: - C:\xampp\php8\php.ini You can also runphp --ini
in a terminal to see which files are used by PHP in CLI mode. Alternatively, you can run Composer with--ignore-platform-req=ext-mongodb
to temporarily ignore these required extensions.
And for the second one:
You are running Composer with SSL/TLS protection disabled. Using version ^1.0 for doctrine/mongodb-odm Running composer update doctrine/mongodb-odm Loading composer repositories with package information Updating dependencies Your requirements could not be resolved to an installable set of packages. Problem 1 - doctrine/mongodb-odm[1.0.0, ..., 1.0.8] require symfony/console ~2.3|~3.0 -> found symfony/console[v2.3.0, ..., v2.8.52, v3.0.0, ..., v3.4.47] but it conflicts with your root composer.json require (6.2.*). - doctrine/mongodb-odm[1.1.0, ..., 1.3.7] require php ^5.6 || ^7.0 -> your php version (8.1.11) does not satisfy that requirement. - Root composer.json requires doctrine/mongodb-odm ^1.0 -> satisfiable by doctrine/mongodb-odm[1.0.0, ..., 1.3.7].
As you can see, in the first error message he trying to say me that i have some packages not compatible with the installation of mongo's extension. In the second, with the default command installation, he's trying to install 1.0 version instead 2.4.*!
What i've tried?
So, i tried to 'force' the installation. I've insert "doctrine/mongodb-odm": "^2.4.0"
in the composer.json , followed by composer update doctrine/mongodb-odm
and i still get the error:
Problem 1- Root composer.json requires doctrine/mongodb-odm ^2.4.0 -> satisfiable by doctrine/mongodb-odm[2.4.0, 2.4.1, 2.4.2, 2.4.3]. - doctrine/mongodb-odm[2.4.0, ..., 2.4.3] require ext-mongodb ^1.5 -> it is missing from your system. Install or enable PHP's mongodb extension.
What i suppose?
Maybe can be the extension of mongo DB in the php.ini file, but i ve installed mongoDB also on windows and added the extension in the php.ini file, but nothing is changed.
Any ideas? Thx