php致命错误:使用作曲家安装用户捆绑包时,内存容量耗尽 [英] Php Fatal error: momory size exhausted when using composer to install user-bundle

查看:54
本文介绍了php致命错误:使用作曲家安装用户捆绑包时,内存容量耗尽的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用作曲家安装FOSuserbundle时,我在终端中收到以下消息:

PHP致命错误:phar中的可用内存大小为536870912字节已用尽(试图分配79字节) :///Users/myname/MyWebSite/composer.phar/src/Composer/ DependencyResolver / Solver.php行177

When triing to install FOSuserbundle with composer I got the following message in the Terminal:
"PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 79 bytes) in phar:///Users/myname/MyWebSite/composer.phar/src/Composer/ DependencyResolver/Solver.php on line 177"

如何修复它?

编辑/其他信息

在终端输入: php -r echo ini_get('memory_limit')。PHP_EOL;

为我提供以下内容: 128M

而php .ini(App / MAMP / conf / php5.4.4 / php.ini)具有以下行: memory_limit = 32M

为什么值不同?
如何更改值,以便作曲家可以安装捆绑软件?

why different value? how can I change the value so that composer can install the bundle?

我在终端中尝试了以下操作,但出现了错误: php -d memory_limit = 512M composer.phar / src / Composer / DependencyResolver / Solver.php

错误==> 无法打开输入文件:composer.phar / src / Composer / DependencyResolver / Solver.php

I tried the following in terminal but got an error: php -d memory_limit=512M composer.phar/src/Composer/DependencyResolver/Solver.php
error ==> Could not open input file: composer.phar/src/Composer/DependencyResolver/Solver.php

推荐答案

我过去通过简单地使用以下方法解决了这个问题:

I've solved this in the past by using simply:

php -d memory_limit=1G /usr/local/bin/composer update --prefer-dist --no-dev

没有开发的地方也可以帮助减少内存占用-当然可以提高速度。

Where the no-dev may help reduce the memory footprint too - certainly speed.

这篇关于php致命错误:使用作曲家安装用户捆绑包时,内存容量耗尽的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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