Articles in this section

Composer installation/update fails on a Plesk server: Allowed memory size of X bytes exhausted

Plesk for Linux kb: technical ABT: Group B

Applicable to:

  • Plesk for Linux

Symptoms

When installing or updating Composer in Plesk or via a command-lin interface, the operation fails with the error message:

PLESK_ERROR: 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

 

Using Plesk Composer extension

 

  1. Log in to Plesk.

  2. Go to Domains > example.com > PHP Composer > Environment variables.

  3. Click Specify under Environment variables.


    Screenshot_2021-04-23_PHP_Composer_for_example_com_-_Plesk_Obsidian_18_0_34_6_.png

  4. Add the following environment variable:

    CONFIG_TEXT: memory_limit = 2048M

    Note: Set memory_limit to -1 to make it unlimited.


    Screenshot_2020-12-09_PHP_Composer_for_plesktest_tld_-_Plesk_Obsidian_18_0_30.png

    If the command fails with the same error, increase the memory_limit value or try to use this variable instead:

    CONFIG_TEXT: COMPOSER_MEMORY_LIMIT = 2048M

 

Via a command-line interface

 

  1. Connect to the Plesk server via SSH.

  2. 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.

 

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.