我试图通过运行下面的命令将HWIOAuthBundle添加到我的项目中。

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

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

当我试图运行作曲家要求,我得到了内存错误。

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 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 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文件中设置内存限制为2G,但没有工作。我找到我的php.ini通过运行php -i | grep php.ini


当前回答

在我的情况下,我试图安装Laravel框架没有说明xampp服务器(或apache服务器)在我的windows系统,我得到以下错误

致命错误:允许的1610612736字节内存耗尽

当我启动xampp服务器(或apache服务器)时,它就开始安装laravel框架,错误就消失了。

所以有时候你必须检查这个,否则它会比平时花费更长的时间,消耗更多的内存,结果大小会被耗尽。

其他回答

Here is another way to solve this problem under windows, if you use Wampserver. Indeed at the level of wampserver, there are two php.ini files, that of PHP, which one can find in the location C: \ wamp64 \ bin \ php \ phpx.xx \ php.ini and that of Apache , which can be found at location C: \ wamp64 \ bin \ apache \ apachex.xx \ bin \ php.ini. Both of these files have the memory_limit parameter. So to be sure to solve this problem, it is better to set the memory_limit = -1 parameter in both files at once.

只是想分享一下我在这件事上的情况。

问题背景:

在一个流浪的盒子里运行作曲家。 在尝试运行composer require " laravell -doctrine/orm:~1.4.13"后得到此消息:

致命错误:在phar:///usr/local/bin/composer/src/ composer/ DependencyResolver/RuleWatchGraph.php第52行中,允许的内存大小为1610612736字节已耗尽(试图分配4096字节) 有关如何处理内存不足错误的更多信息,请访问https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors。

已尝试将php.ini内存限制设置为-1。(仍然没有工作)。

解决方案:

显然是我的作曲家。Json和composer。洛克有一些问题。 运行$ composer validate,结果是: “锁文件不符合composer的最新更改。Json,建议您运行composer update。 所以我运行$ composer update,所有依赖项都被解析了。依我之见,当依赖关系出现问题时,可能是树的构建不同步,因此出现内存不足的问题。

希望这对大家有所帮助。

窗户呢?

我用的是Windows 10,这个命令对我来说很管用,

php -d memory_limit=-1 "C:\ProgramData\ComposerSetup\bin\composer.phar" update

Centos 7使用:

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

对于macOS Catalina和macOS Big Sur中的此错误,请使用以下代码行:

PHP -d memory_limit=-1 /usr/local/bin/composer update——no-plugins

我用这句话来更新Symfony 5。这个命令也适用于laravel 7。