Composer & Symfony - Fatal error: Out of memory

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-24 20:17:18

问题


I'm running Symfony 3.4 LTS with composer. My website works fine, but when I try to update any bundle with :

php composer.phar update
# or
php composer.phar update symfony/symfony
# or
php composer.phar update swiftmailer/swiftmailer

I get this error :

PHP Fatal error: Out of memory [...] in phar:/// [...]

Below is what I have already tested :

  • increase my memory_limit from 196M to 1024M
  • run the composer.phar with php -d memory_limit = -1

.. with no success. What else could I try ? By the way, if I run free -m :

total used free shared buffers cached
Mem: 2002 361 1641 0 7 82
-/+ buffers/cache: 270 1732
Swap: 255 255 0

回答1:


use symfony/flex, it embeds optimzations that should reduce the memory requirements of Composer a lot




回答2:


I solved my issue.

  • Backup website files in local
  • Install Wamp and run the servers
  • Increase memory limit to 2G
  • Make the composer update
  • Upload the files to the production server

I'm very confusing about composer and its requirements. It's crazy...




回答3:


php -d memory_limit=-1 `which composer` update



回答4:


Update composer to latest version with this command, composer selfupdate and then run require command

as mentioned in this asnwer, https://github.com/composer/composer/issues/2704#issuecomment-56169024,

this worked for me.




回答5:


had the same issue on my live server.

rm -R vendor/
composer install

works fine, when composer.json is up to date.



来源:https://stackoverflow.com/questions/51265113/composer-symfony-fatal-error-out-of-memory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!