3

When I'm trying to install a new bundle with composer, I'm always running into this problem:

PHP Fatal error:  Out of memory (allocated 1690828800) (tried to allocate 268435456 bytes) in phar://C:/.../composer.phar/src/Composer/DependencyResolver/Solver.php on line 220

Fatal error: Out of memory (allocated 1690828800) (tried to allocate 268435456 bytes) in phar://C:/.../composer.phar/src/Composer/DependencyResolver/Solver.php on line 220

I tried to raise the memory limit in php.ini and started a whole new project with fresh composer. I should have enough memory on my machine.

Update:

When encountering this problem, also bear in mind that if you change parameters in your PHP.ini, that you've to change them for your PHP CLI. I often forgot that and just changed the php.ini for the version my apache is using...

Lukas
  • 169
  • 1
  • 3
  • 8

8 Answers8

6

try
composer clear-cache
before
composer update

pok_net
  • 358
  • 3
  • 12
3

COMPOSER_MEMORY_LIMIT=-1 to update composer..

COMPOSER_MEMORY_LIMIT=-1 fixed the problem for me while updating/installing packages using composer

Jaimil Patel
  • 1,301
  • 6
  • 13
Sai
  • 539
  • 6
  • 7
2

This command solved my problem.

php -d memory_limit=-1 /usr/local/bin/composer install
1

How you test Memory_limit ?

did you restart Apache?

please do the following steps:

with Xampp in Windows 10

just search this phrase: memory_limit

;memory_limit=512M 

by commenting this configuration, in php.ini to:

memory_limit =-1

then restart the Apache by xampp

enter image description here

the result is:

; Maximum amount of memory a script may consume
; http://php.net/memory-limit
memory_limit =-1
;memory_limit=512M
saber tabatabaee yazdi
  • 4,404
  • 3
  • 42
  • 58
0

You can do php -d memory_limit=-1 /path/to/composer ... like explained in the doc.

mykiwi
  • 1,671
  • 1
  • 19
  • 35
  • already did that. Did it in the php.ini file as well as with the parameters. There's no othe result – Lukas Aug 29 '17 at 09:27
0

I had this error. My solution was to update the self composer $ php composer.phar self-update

Andrey V.
  • 72
  • 4
0

in windows i used this commands:

php -d memory_limit=-1 C:\composer\composer.phar install

and

php C:\composer\composer.phar self-update

Updating to version 1.10.10 (stable channel).
Downloading (100%)

Use composer self-update --rollback to return to version 1.10.7

saber tabatabaee yazdi
  • 4,404
  • 3
  • 42
  • 58
0

Run COMPOSER_MEMORY_LIMIT=-1 composer install instead of composer install. It worked for me.

Brn.Rajoriya
  • 1,534
  • 2
  • 23
  • 35