composer的一些报错及解决

问题1

执行以下命令:

composer require sonata-project/doctrine-orm-admin-bundle "2.3.*"

报错:

PHP Fatal error:  Allowed memory size of 1610612736 bytes exhausted (tried to allocate 32 bytes)

解决:

php -r "echo ini_get('memory_limit').PHP_EOL;"  # 查看memory大小

COMPOSER_MEMORY_LIMIT=-1 composer require sonata-project/doctrine-orm-admin-bundle  # 临时设置memory大小

参看官方说明(打开太慢了):
https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors

问题2

but these conflict with your requirements or minimum-stability.

解决:在composer.json中添加以下

"minimum-stability": "dev",

参考
Composer问题集锦

切换composer国内镜像

composer config -g repo.packagist composer https://packagist.phpcomposer.com

你可能感兴趣的:(php)