mac系统中使用mamp+composer.phar安装yii2

2020-11-03  本文已影响0人  韩小禹
# /Applications/MAMP/bin/php/php7.2.22/bin/php  是mamp中某个php版本的具体位置
# /usr/local/bin/php72   是路径,其中php72是自己定义的名字

cp /Applications/MAMP/bin/php/php7.2.22/bin/php  /usr/local/bin/php72
php72 composer.phar config -g repo.packagist composer https://mirrors.aliyun.com/composer/
php72 composer.phar require --prefer-dist yiisoft/yii2-mongodb
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - yiisoft/yii2-mongodb[2.1.0, ..., 2.1.9] require ext-mongodb >=1.0.0 -> it is missing from your system. Install or enable PHP's mongodb extension.
    - Root composer.json requires yiisoft/yii2-mongodb ^2.1 -> satisfiable by yiisoft/yii2-mongodb[2.1.0, ..., 2.1.9].

To enable extensions, verify that they are enabled in your .ini files:
    - /Applications/MAMP/bin/php/php7.2.22/conf/php.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.
php72 composer.phar require --prefer-dist yiisoft/yii2-mongodb

# 命令执行后有如下提示:

Using version ^2.1 for yiisoft/yii2-mongodb
./composer.json has been updated
Running composer update yiisoft/yii2-mongodb
Loading composer repositories with package information
Updating dependencies
Lock file operations: 1 install, 0 updates, 3 removals
  - Removing bshaffer/oauth2-server-php (v1.11.1)
  - Removing filsh/yii2-oauth2-server (v2.1.1)
  - Removing windhoney/yii2-rest-rbac (1.0.9)
  - Locking yiisoft/yii2-mongodb (2.1.9)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 0 updates, 3 removals
  - Downloading yiisoft/yii2-mongodb (2.1.9)
  - Removing windhoney/yii2-rest-rbac (1.0.9)
  - Removing filsh/yii2-oauth2-server (v2.1.1)
  - Removing bshaffer/oauth2-server-php (v1.11.1)
  - Installing yiisoft/yii2-mongodb (2.1.9): Extracting archive
Package phpunit/php-token-stream is abandoned, you should avoid using it. No replacement was suggested.
Generating autoload files
28 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
如果哪里看不明白或者觉得我写的不清楚,可以私信我。我是费了很大的功夫才解决的,愿意分享出来。
上一篇 下一篇

猜你喜欢

热点阅读