Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

composer install 过程中遇到的问题 #42

Open
plsxysam opened this issue Oct 18, 2020 · 3 comments
Open

composer install 过程中遇到的问题 #42

plsxysam opened this issue Oct 18, 2020 · 3 comments

Comments

@plsxysam
Copy link

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 mongodb/mongodb 1.7.1 -> satisfiable by mongodb/mongodb[1.7.1].
- mongodb/mongodb 1.7.1 requires ext-mongodb ^1.8 -> the requested PHP extension mongodb is missing from your system.
Problem 2
- Installation request for phar-io/manifest 2.0.1 -> satisfiable by phar-io/manifest[2.0.1].
- phar-io/manifest 2.0.1 requires ext-dom * -> the requested PHP extension dom is missing from your system.
Problem 3
- Installation request for phpunit/php-code-coverage 9.2.0 -> satisfiable by phpunit/php-code-coverage[9.2.0].
- phpunit/php-code-coverage 9.2.0 requires ext-dom * -> the requested PHP extension dom is missing from your system.
Problem 4
- Installation request for phpunit/phpunit 9.4.0 -> satisfiable by phpunit/phpunit[9.4.0].
- phpunit/phpunit 9.4.0 requires ext-dom * -> the requested PHP extension dom is missing from your system.
Problem 5
- Installation request for theseer/tokenizer 1.2.0 -> satisfiable by theseer/tokenizer[1.2.0].
- theseer/tokenizer 1.2.0 requires ext-dom * -> the requested PHP extension dom is missing from your system.
Problem 6
- mongodb/mongodb 1.7.1 requires ext-mongodb ^1.8 -> the requested PHP extension mongodb is missing from your system.
- jenssegers/mongodb v3.8.0 requires mongodb/mongodb ^1.6 -> satisfiable by mongodb/mongodb[1.7.1].
- Installation request for jenssegers/mongodb v3.8.0 -> satisfiable by jenssegers/mongodb[v3.8.0].

尝试一:
composer require jenssegers/mongodb
composer require jenssegers/mongodb --ignore-platform-reqs
无响应

尝试二:
pecl install mongodb

ps: 我使用的是php73,pecl在/opt/remi/php73/root/usr/bin/pecl

尝试二成功后,执行composer install

Problem 1
- Installation request for mongodb/mongodb 1.7.1 -> satisfiable by mongodb/mongodb[1.7.1].
- mongodb/mongodb 1.7.1 requires ext-mongodb ^1.8 -> the requested PHP extension mongodb is missing from your system.
Problem 2
- mongodb/mongodb 1.7.1 requires ext-mongodb ^1.8 -> the requested PHP extension mongodb is missing from your system.
- jenssegers/mongodb v3.8.0 requires mongodb/mongodb ^1.6 -> satisfiable by mongodb/mongodb[1.7.1].
- Installation request for jenssegers/mongodb v3.8.0 -> satisfiable by jenssegers/mongodb[v3.8.0].

尝试三:
composer换源安装 jenssegers/mongodb

提示缺少 ext-mongodb

尝试四:
pecl安装mongodb成功
pecl/mongodb is already installed and is the same as the released version 1.8.1
但是php -m 没有发现mongodb扩展

so 修改php.ini 手动添加
extension=mongodb

完成以上步骤,composer install 成功

End

@jiannei
Copy link
Owner

jiannei commented Oct 19, 2020

@plsxysam 感谢分享:clap::clap::clap:

这个是从 Lumen 7 升级到 Lumen 8 时对版本的依赖的扩展包版本要求不一致导致的问题,我当时是使用 composer require jenssegers/mongodb:3.8.x指定对应的依赖版本。

@jiannei
Copy link
Owner

jiannei commented Nov 3, 2020

补充另外一种安装方法:

  1. https://pecl.php.net/package/mongodb 查找 MongoDB 扩展最新版本(目前最新版是 1.9.1)
    2.(下载最新版本) wget https://pecl.php.net/get/mongodb-1.9.1.tgz
    3.解压
    tar zxvf mongodb-1.9.1.tgz
    cd mongodb-1.9.1/
    4.使用php 配置文件,编译安装,比如
/www/server/php/74/bin/phpize 
./configure --with-php-config=/www/server/php/74/bin/php-config
make && make install
  1. php.ini 中启用
extension = /www/server/php/74/lib/php/extensions/no-debug-non-zts-20190902/mongodb.so

@jiannei
Copy link
Owner

jiannei commented Dec 16, 2020

环境 Mac 版本 Homstead v9.4.0 安装方法:

  • 更新环境
sudo apt-get update
sudo pecl channel-update pecl.php.net
  • 安装 mongodb 扩展
sudo pecl install mongodb
  • 查看当前运行 php 配置文件位置
php -v
ps -ef | grep php
  • php.ini 添加扩展配置(需要找相对应版本 php 的配置文件,我这里是 php7.4)
//    /etc/php/7.4/cli/php.ini
extension=mongodb

// /etc/php/7.4/fpm/php.ini
  • 重启并验证
sudo service php7.4-fpm restart
php -m | grep mongodb
php --ri mongodb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants