Introduction
i try to using monodb database with laravel 10
Environment Details
- Operating System: Ubuntu
- PHP Version: 8.1
- MongoDB Version: 6
- Laravel MongoDB package :
"mongodb/laravel-mongodb": "4.2.0"
what i update
sudo pecl install mongodb
Update php.ini
extension=mongodb.so
Error List
Problem 1
- mongodb/laravel-mongodb is locked to version 4.2.0 and an update of this package was not requested.
- mongodb/laravel-mongodb 4.2.0 requires ext-mongodb ^1.15 -> it has the wrong version installed (1.12.0).
Problem 2
- mongodb/mongodb is locked to version 1.17.1 and an update of this package was not requested.
- mongodb/mongodb 1.17.1 requires ext-mongodb ^1.17.0 -> it has the wrong version installed (1.12.0).
It seems that you have an old version of the PHP's MongoDB extension, so you need to update it.
To update this extension, you have to run the following command on your terminal:
This way, your MongoDB extension will be updated to the latest version (which is
1.17.3, at the time of writing this answer)Side note: PHP 8.1 is no longer actively supported, currently it's only accepting critical security fixes, and in November it will reach its end-of-life stage, so it's highly recommended that you update to version 8.2 or 8.3.