A machine-readable guide to this site for AI agents and language models is available at/llms.txt(https://dev.acquia.com/llms.txt on the production site).
Overriding memory limits during local development with Composer | Cloud Platform | Acquia Product Documentation
Cloud Platform
Overriding memory limits during local development with Composer
Overriding memory limits during local development with Composer
Date Published: February 24, 2022
Issue
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:
PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleWatchGraph.php on line 52
Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleWatchGraph.php on line 52
Resolution
To override this and fix the issue on your local machine you can do the following changes within your php.ini configuration file.
To locate your php.ini configuration file you can use the following command: php --ini
After running this command you should see an output like the following:
The file we want to change is the Loaded Configuration File When you open the file you can search for the memory_limit setting and then update it accordingly. You can try to incrementally override this value and re-run your composer commands or alternatively, you can set the memory_limit = -1 to give an unlimited amount of memory to PHP processes.
After saving your file, you can verify the PHP changes by running this command which will output the current memory settings in your php.ini file:
php -r "echo ini_get('memory_limit').PHP_EOL;"
For more information on this issue, you can view the documentation on Composer docs: