Wednesday, February 9, 2022

[FIXED] PHP Fatal error: Allowed memory size of 1610612736 bytes composer update

Issue

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.

Solution

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


Answered By - Mhluzi Bhaka

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.