X_slasher
X_slasher

Reputation: 71

Out of memory error in 'Composer update' command inside docker container in Aws ec2 instance

I have tried to run 'composer update' command inside docker container in Aws ec2 instance. But I get this error

  mmap() failed: [12] Cannot allocate memory

  mmap() failed: [12] Cannot allocate memory

  Fatal error: Out of memory (allocated 478179328) (tried to allocate 20996408 bytes) in phar:///usr/local/bin/composer/src/Composer/Util/RemoteFilesystem.php on line 462

I have tried using "memory_limit = -1" or "memory_limit = 2G" in the php configaration file. I have also tried to run this command "php -d memory_limit=-1 /usr/local/bin/composer update" inside my docker container. But it still shows the same error

Upvotes: 1

Views: 1878

Answers (1)

Joundill
Joundill

Reputation: 7554

Run composer update in your local environment, then commit composer.json and composer.lock to your code repository, pull the changes in your ec2 instance and run composer install.

Commonly, low resource servers don't have enough RAM to run composer update. You're better off doing it in your local environment, and only using composer install on your server.

Upvotes: 4

Related Questions