MongoDB扩展安装失败
看报错信息,是illuminate的版本太高?需要降低illuminate的版本吗?
"require": {
"php": ">=8.1",
"workerman/webman-framework": "^2.1",
"monolog/monolog": "^2.0",
"saithink/saiadmin": "^5.1",
"ext-pdo": "*",
"webman/database": "^2.1",
"illuminate/pagination": "^12.35",
"illuminate/events": "^12.35",
"symfony/var-dumper": "^7.3"
},
运行:composer require -W webman/database mongodb/laravel-mongodb ^4.8
./composer.json has been updated
Running composer update webman/database mongodb/laravel-mongodb --with-all-dependencies
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires mongodb/laravel-mongodb ^4.8 -> satisfiable by mongodb/laravel-mongodb[4.8.0, ..., 4.9.x-dev].
- mongodb/laravel-mongodb[4.8.0, ..., 4.9.x-dev] require illuminate/events ^10.0|^11 -> found illuminate/events[v10.0.0, ..., 10.x-dev, v11.0.0, ..., 11.x-dev] but it conflicts with your root composer.json require (^12.35).
- mongodb/laravel-mongodb 4.9.0 requires ext-mongodb ^1.21|^2 -> it has the wrong version installed (1.19.1).
To enable extensions, verify that they are enabled in your .ini files:
- /Applications/ServBay/package/etc/php/8.2/php.ini
- /Applications/ServBay/package/etc/php/8.2/conf.d/imagick.ini
- /Applications/ServBay/package/etc/php/8.2/conf.d/mongodb.ini
- /Applications/ServBay/package/etc/php/8.2/conf.d/redis.ini
- /Applications/ServBay/package/etc/php/8.2/conf.d/swoole.ini
- /Applications/ServBay/package/etc/php/8.2/conf.d/xdebug.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.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require webman/database:*" to figure out if any version is installable, or "composer require webman/database:^2.1" if you know which you need.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
使用的servbay集成开发环境,php8.2
还需要升级 ext-mongodb版本吗?
根据错误提示
mongodb/laravel-mongodb ^4.8 要求 illuminate/events(Laravel 的事件组件)版本为 ^10.0|^11,但你的项目中依赖的是 ^12.35(更高版本),两者不兼容。
mongodb/laravel-mongodb (4.9.0) 需要 PHP 的 ext-mongodb 扩展版本为 ^1.21|^2,但你当前安装的是 1.19.1,版本不满足。降低illuminate/events版本不知道对其他illuminate相关组件有没有影响?