No image

Composer Memory Error

Should you get a composer memory error or status message “killed” when using sudo composer upgrade on aMiSTACX, it is because of an incorrect setting w/ PHP 7.x, or the memory value is set too low.

Although most of our stacks G5s through G3s have PHP preconfigured for the stack with multiple PHP versions, and 2G, you may occasionally find a value less than 2G. Even with 2GB set, sometimes you just need more memory, because on some stacks we have removed the swap file.

As a quick work-around, increase to 2G or 3G, reload PHP or reboot the server. In some cases you may also need to also temporarily increase your instance size so you have more than 2GB of free memory available.

A helpful command to determine what memory value PHP-CLI is set at, run the following:

sudo php -r "echo ini_get('memory_limit').PHP_EOL;"

To change the value edit the PHP CLI file:

sudo nano /etc/php/7.x/cli/php.ini

Where x = your current php version. # php -v

Ref: https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors

You can also do the following:
sudo reboot
delete or rename the /magento/composer.lock file
sudo composer dumpautoload
sudo composer clearcache
sudo php -d memory_limit=4G /usr/local/bin/composer update

*Where memory_limit= available memory between 2GB and 4GB

Lead~Robot

Comments are closed.