1

I want to run the command composer update to my Laravel project by running the below command.

composer update

When I try to run composer require I am getting the out of memory error.

PHP Fatal error:  Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/DependencyResolver/Solver.php on line 223

Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/DependencyResolver/Solver.php on line 223

Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.
Mhluzi Bhaka
  • 1,364
  • 3
  • 19
  • 42
Sleepy Bed
  • 19
  • 1
  • 4

2 Answers2

5

Run

which composer

This will give you the path to composer like "/usr/bin/composer"

Then use that path in the command below to overcome the memory limit using the php flag for no memory limit, like this:

php -d memory_limit=-1 /usr/bin/composer update
Mhluzi Bhaka
  • 1,364
  • 3
  • 19
  • 42
0

Run

COMPOSER_MEMORY_LIMIT=-1 composer update

That temporarily sets the composer memory limit to unlimited.

Valeri
  • 327
  • 1
  • 5
  • 15
  • Thank you for this code snippet, which might provide some limited, immediate help. A [proper explanation](https://meta.stackexchange.com/q/114762/349538) would greatly improve its long-term value by showing why this is a good solution to the problem and would make it more useful to future readers with other, similar questions. Please [edit] your answer to add some explanation, including the assumptions you've made. – wscourge Nov 27 '20 at 08:07