Problem with installation of MongoDB-odm on Symfony 6 - php

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 run php --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

The problem was the MongoDB drivers. So, what i did is:
Download the MongoDB package with DLL included.
Copy the DLL extension of Mongo inside php/ext folder
execute pecl install mongodb
For the next, follow this Documentation.

Related

Trying to composer update this error came up on CentOs

I'm trying to deploy my laravel project on CentOs system. When im going to run composer update command i am encountering this error. I can't figure out the solution and I saerched for soloution in this platform. I found for windows but not work on my CentOs system.
Soliton for windows;
I am going to add this line in php.ini file: extension=php_fileinfo.dll but didn't work.
Error Message;
Continue as root/super user [yes]? yes
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- laravel/framework[v8.12.0, ..., 8.x-dev] require league/flysystem ^1.1 -> satisfiable by league/flysystem[1.1.0, ..., 1.x-dev].
- league/flysystem[1.1.0, ..., 1.x-dev] require ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension.
- Root composer.json requires laravel/framework ^8.12 -> satisfiable by laravel/framework[v8.12.0, ..., 8.x-dev].
To enable extensions, verify that they are enabled in your .ini files:
- /opt/cpanel/ea-php74/root/etc/php.ini
- /opt/cpanel/ea-php74/root/etc/php.d/20-bcmath.ini
- /opt/cpanel/ea-php74/root/etc/php.d/20-calendar.ini
- /opt/cpanel/ea-php74/root/etc/php.d/20-ctype.ini
- /opt/cpanel/ea-php74/root/etc/php.d/20-curl.ini
- /opt/cpanel/ea-php74/root/etc/php.d/20-dom.ini
- /opt/cpanel/ea-php74/root/etc/php.d/20-ftp.ini
- /opt/cpanel/ea-php74/root/etc/php.d/20-gd.ini
- /opt/cpanel/ea-php74/root/etc/php.d/20-iconv.ini
- /opt/cpanel/ea-php74/root/etc/php.d/20-imap.ini
- /opt/cpanel/ea-php74/root/etc/php.d/20-json.ini
- /opt/cpanel/ea-php74/root/etc/php.d/20-mbstring.ini
- /opt/cpanel/ea-php74/root/etc/php.d/20-mysqlnd.ini
- /opt/cpanel/ea-php74/root/etc/php.d/20-pdo.ini
- /opt/cpanel/ea-php74/root/etc/php.d/20-phar.ini
- /opt/cpanel/ea-php74/root/etc/php.d/20-posix.ini
- /opt/cpanel/ea-php74/root/etc/php.d/20-simplexml.ini
- /opt/cpanel/ea-php74/root/etc/php.d/20-sockets.ini
- /opt/cpanel/ea-php74/root/etc/php.d/20-sqlite3.ini
- /opt/cpanel/ea-php74/root/etc/php.d/20-tokenizer.ini
- /opt/cpanel/ea-php74/root/etc/php.d/20-xml.ini
- /opt/cpanel/ea-php74/root/etc/php.d/20-xmlwriter.ini
- /opt/cpanel/ea-php74/root/etc/php.d/20-xsl.ini
- /opt/cpanel/ea-php74/root/etc/php.d/30-mysqli.ini
- /opt/cpanel/ea-php74/root/etc/php.d/30-pdo_mysql.ini
- /opt/cpanel/ea-php74/root/etc/php.d/30-pdo_sqlite.ini
- /opt/cpanel/ea-php74/root/etc/php.d/30-xmlreader.ini
- /opt/cpanel/ea-php74/root/etc/php.d/zzzzzzz-pecl.ini
You can also run `php --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-fileinfo` to temporarily ignore these required extensions.
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
One of your required package need a specific php extension in your CentOs system.
See the 2nd line error message thrown by composer update
- league/flysystem[1.1.0, ..., 1.x-dev]
require ext-fileinfo * -> it is missing from your system.
Install or enable PHP's fileinfo extension.
Please enable this missing php extension by uncomment it from inside your CentOs php.ini
The missing extension is ext-fileinfo
Note: also a good idea to run "composer install" when deploying your project in new environment, to minimize sudden package version updated that might trigger installation issues.
Also dont forget to upload your composer.lock as well.
Have a look at documentation here:
https://laravel.com/docs/9.x/deployment#autoloader-optimization

My new Laravel project doesn't start correctly

I'm using windows 10 and I'm totally new in Laravel and PHP
I installed php, composer, node, npm and Laravel and wrote my first command in powershell
laravel new myNewSite
Then I got this error, I don't know what is it:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- laravel/framework[v8.65.0, ..., 8.x-dev] require league/flysystem ^1.1 -> satisfiable by league/flysystem[1.1.0, ..., 1.x-dev].
- league/flysystem[1.1.0, ..., 1.x-dev] require ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension.
- Root composer.json requires laravel/framework ^8.65 -> satisfiable by laravel/framework[v8.65.0, ..., 8.x-dev].
To enable extensions, verify that they are enabled in your .ini files:
- C:\Program Files\php-8.0.13\php.ini
You can also run php --ini inside terminal to see which files are used by PHP in CLI mode.
I looked for a solution and I came up with deleting the beginning ; in extension=fileinfo in php.ini-development and php.ini-production files but nothing changed, the same error still exists. So what should I do?
I solved the problem
I copied my file path
C:\Program Files\php-8.0.13\php.ini
I pasted it in the explorer bar
PHP file Notepad came up in the screen
I looked for ;extension=fileinfo and found it
I deleted the beginning ;
I saved the file
that's it guys!

Getting error when running composer install on CRAFT CMS project on Windows

Setup: Windows 10, PHP 8.0.2, composer 2.1.6
I cloned a project from bitbucket and ran composer install.
After Running the command I got the error bellow.
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Your lock file does not contain a compatible set of packages. Please run composer update.
Problem 1
- ibericode/vat is locked to version 1.2.1 and an update of this package was not requested.
- ibericode/vat 1.2.1 requires ext-soap * -> it is missing from your system. Install or enable PHP's soap extension.
Problem 2
- ibericode/vat 1.2.1 requires ext-soap * -> it is missing from your system. Install or enable PHP's soap extension.
- craftcms/commerce 3.4.2 requires ibericode/vat ^1.1.2 -> satisfiable by ibericode/vat[1.2.1].
- craftcms/commerce is locked to version 3.4.2 and an update of this package was not requested.
To enable extensions, verify that they are enabled in your .ini files:
- C:\PHP\php.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
I tried running composer update, but I was presented wit h a similar error.
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- ibericode/vat[1.1.2, ..., 1.2.1] require ext-soap * -> it is missing from your system. Install or enable PHP's soap extension.
- craftcms/commerce 3.4.2 requires ibericode/vat ^1.1.2 -> satisfiable by ibericode/vat[1.1.2, 1.1.3, 1.2.0, 1.2.1].
- Root composer.json requires craftcms/commerce 3.4.2 -> satisfiable by craftcms/commerce[3.4.2].
To enable extensions, verify that they are enabled in your .ini files:
- C:\PHP\php.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
Steps that I tried:
enable soap extension in php.ini
confirm that php_soap.dll is in the php extension folder php/ext
restart the machine
But that didn't help.
Then I tried the answer provided in https://craftcms.stackexchange.com/a/30270
That didn't help either.

Installing Composer to get local files of Magento

I have a Debian VM with a Magento 2.1.7 Installed. Now, in order to get the files in local and being able with the IDE (I use phpStorm from JetBrains) to sync the files from local to remote with a Save I need to have the Magento files too in local.
The truth is that the only path I have in sync is:
/opt/bitnami/apps/Magento/htdocs/app
But anyway, having all the files and the vendor in local gives me the ability to have changes in local and not in the VM and I get organized better.
The problem comes when I want to install the Magento 2 files. I used to do computer install in other computers where everything was set up and all the dependencies got installed without any problem.
But in the machine I'm setting up now and I will work from now on I need to set it up.
Basically when I run composer install where I need to install the dependencies it says:
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for braintree/braintree_php 3.7.0 -> satisfiable by braintree/braintree_php[3.7.0].
- braintree/braintree_php 3.7.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
Problem 2
- Installation request for magento/framework 100.1.9 -> satisfiable by magento/framework[100.1.9].
- magento/framework 100.1.9 requires ext-curl * -> the requested PHP extension curl is missing from your system.
Problem 3
- Installation request for magento/magento2-base 2.1.9 -> satisfiable by magento/magento2-base[2.1.9].
- magento/magento2-base 2.1.9 requires ext-intl * -> the requested PHP extension intl is missing from your system.
Problem 4
- Installation request for magento/module-shipping 100.1.3 -> satisfiable by magento/module-shipping[100.1.3].
- magento/module-shipping 100.1.3 requires ext-gd * -> the requested PHP extension gd is missing from your system.
Problem 5
- Installation request for magento/product-community-edition 2.1.9 -> satisfiable by magento/product-community-edition[2.1.9].
- magento/product-community-edition 2.1.9 requires ext-curl * -> the requested PHP extension curl is missing from your system.
Problem 6
- braintree/braintree_php 3.7.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- magento/module-braintree 100.1.6 requires braintree/braintree_php 3.7.0 -> satisfiable by braintree/braintree_php[3.7.0].
- Installation request for magento/module-braintree 100.1.6 -> satisfiable by magento/module-braintree[100.1.6].
To enable extensions, verify that they are enabled in your .ini files:
- C:\php.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
As far as I understand and I can read, I need a php.ini in the folder which tells the composer how to get the dependencies. I haven't found the file, i found two files:
php.ini-production
php.ini-development
I imagine these two files are the ones magento use once we change the mode, so, do I need to change these 2 eventually?
How can I fix this?
I managed to fix the problem by modifing the php.ini file that I had in C:\php.ini. I couldn't find it earlier but once found, just get rid of the comments on the sections you need.

yii framework: not able to install MongoDb extension for yii2

I want to use mongodb with yii framework for that i am trying to install mongodb extension. As per the documentation given at http://www.yiiframework.com/doc-2.0/ext-mongodb-index.html i have already added line ""yiisoft/yii2-mongodb": "~2.0.0"" in my composer.json file.
But whenever i issue command composer update to install this extension it gives me below error.
Your requirements could not be resolved to an installable set of packages.
Problem 1
- yiisoft/yii2-mongodb 2.0.4 requires ext-mongo >=1.5.0 -> the requested PHP extension mongo is missing from your system.
- yiisoft/yii2-mongodb 2.0.3 requires ext-mongo >=1.5.0 -> the requested PHP extension mongo is missing from your system.
- yiisoft/yii2-mongodb 2.0.2 requires ext-mongo >=1.5.0 -> the requested PHP extension mongo is missing from your system.
I search a lot on this issue and found one solution here https://github.com/yiisoft/yii2-mongodb/issues/18 and here http://www.yiiframework.com/forum/index.php/topic/57726-solved-yii2-mongodb/ that suggest to add line extension=mongo.so in my /etc/php5/cli/php.ini file . but even after adding line to php.ini file command composer update still gives the same error.
Please help
I forgot to install mongodb php extension. after installing this extension it works. here is the link to install mongodb extension http://us1.php.net/manual/en/mongo.installation.php

Categories