Loading...


Related Products


Date Published: January 28, 2022

How to change the PHP memory limit for Composer commands

There is a known issue with composer where when you try to use composer require or composer update you might see the following errors during local development in command line:

PHP Fatal error: Allowed memory size of 1610712738 bytes exhausted (tried to allocate 4098 bytes) in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleWatchGraph.php on line 50 

Or

$ composer update
Loading composer repositories with package information
Warning from https://packages.drupal.org/lenient: Careful, You are using the https://packages.drupal.org/lenient which ignores core version requirements for some projects. See https://www.drupal.org/composer/lenient for more information.
Updating dependencies
Killed

Resolution

To override this and fix the issue on your local machine or Cloud IDE you can run your composer command like the following:

$ COMPOSER_MEMORY_LIMIT=2Gb composer update

Or to have unlimited memory:

$ COMPOSER_MEMORY_LIMIT=-1 composer update

If this did not help we recommend to modify the php.ini. Read more 

Did not find what you were looking for?

If this content did not answer your questions, try searching or contacting our support team for further assistance.

Back to Section navigation