Symptoms
When installing or updating Composer in Plesk or via a command-lin interface, the operation fails with the error message:
PHP Fatal error: Allowed memory size of X bytes exhausted (tried to allocate Y bytes) in phar:///usr/lib/plesk-9.0/composer.phar/src/Composer/DependencyResolver/Rule2Literals.php on line 48
Cause
Memory limit is insufficient for Composer update.
Resolution
-
Go to Domains > example.com > PHP Composer > Environment variables.
-
Click Specify under Environment variables.
-
Add the following environment variable:
memory_limit = 2048M
Note: Set
memory_limit
to-1
to make it unlimited.If the command fails with the same error, increase the
memory_limit
value or try to use this variable instead:COMPOSER_MEMORY_LIMIT = 2048M
-
Connect to the Plesk server via SSH.
-
Run the command specifying the
memory_limit
:# /opt/plesk/php/7.2/bin/php -d memory_limit=2048M /usr/lib/plesk-9.0/composer.phar update
If the command fails with the same error, increase the
memory_limit
value.