Composer require内存不足. PHP致命错误:允许的内存大小为1610612736字节已用尽 [英] Composer require runs out of memory. PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted

查看:1374
本文介绍了Composer require内存不足. PHP致命错误:允许的内存大小为1610612736字节已用尽的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过运行以下命令将HWIOAuthBundle添加到我的项目中.

I am trying to add HWIOAuthBundle to my project by running the below command.

composer require hwi/oauth-bundle php-http/guzzle6-adapter php-http/httplug-bundle

HWIOAuthBundle github: https://github.com/hwi/HWIOAuthBundle

HWIOAuthBundle github: https://github.com/hwi/HWIOAuthBundle

当我尝试运行composer时,我遇到了内存不足错误.

When I try to run composer require I am getting the out of memory error.

将^0.6.0@dev版本用于hwi/oauth-bundle使用^1.2@dev版本 用于php-http/guzzle6-adapter使用版本^1.10@dev php-http/httplug-bundle ./composer.json已更新 包含软件包信息的composer存储库更新依赖项 (包括require-dev)

Using version ^0.6.0@dev for hwi/oauth-bundle Using version ^1.2@dev for php-http/guzzle6-adapter Using version ^1.10@dev for php-http/httplug-bundle ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev)

PHP致命错误:允许的内存大小为1610612736字节已用尽 (尝试分配67108864字节)在 phar:///usr/local/Cellar/composer/1.4.2/libexec/composer.phar/src/Composer/DependencyResolver/Solver.php在第220行

PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 67108864 bytes) in phar:///usr/local/Cellar/composer/1.4.2/libexec/composer.phar/src/Composer/DependencyResolver/Solver.php on line 220

致命错误:允许的内存大小为1610612736字节已用尽(尝试 分配67108864字节) phar:///usr/local/Cellar/composer/1.4.2/libexec/composer.phar/src/Composer/DependencyResolver/Solver.php在第220行

Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 67108864 bytes) in phar:///usr/local/Cellar/composer/1.4.2/libexec/composer.phar/src/Composer/DependencyResolver/Solver.php on line 220

我尝试在php.ini文件中将memory_limit设置为2G,但是没有用.我通过运行php -i | grep php.ini

I tried setting the memory_limit to 2G in my php.ini file but did not work. I found my php.ini by running php -i | grep php.ini

推荐答案

要获取当前的memory_limit值,请运行:

To get the current memory_limit value, run:

php -r "echo ini_get('memory_limit').PHP_EOL;"

尝试增加php.ini文件中的限制(例如,对于类似Debian的系统,为/etc/php5/cli/php.ini):

Try increasing the limit in your php.ini file (ex. /etc/php5/cli/php.ini for Debian-like systems):

; Use -1 for unlimited or define an explicit value like 2G
memory_limit = -1

或者,您可以使用命令行参数来增加限制:

Or, you can increase the limit with a command-line argument:

php -d memory_limit=-1 composer.phar require hwi/oauth-bundle php-http/guzzle6-adapter php-http/httplug-bundle

要获取加载的php.ini文件的位置,请尝试:

To get loaded php.ini files location try:

php --ini

这篇关于Composer require内存不足. PHP致命错误:允许的内存大小为1610612736字节已用尽的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆