T
T
tukreb2020-11-13 00:56:47
Composer
tukreb, 2020-11-13 00:56:47

How to temporarily allocate more php memory for composer install?

The situation is this, the project is on Symfony and when composer install is called, it is executed auto-scripts, cache:clearfor which there is not enough memory.
How can I allocate more memory for composer install?
I tried this:
php -d memory_limit=256M bin/composer install
But the setting in this form is simply ignored and the default value of memory_limit is used.

However, if you call cache:clear directly:
php -d memory_limit=256M bin/console cache:clear
Then everything works.

PS I know that you can remove the call to the cache:clear script from composer and do it separately, but I'm interested in the question of how to make more memory temporarily allocated for composer install.

Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
bkosun, 2020-11-13
@tukreb

In addition to the PHP settings, Composer also respects the limit that is defined in COMPOSER_MEMORY_LIMIT:
You can remove all limits like this:
Windows:

set COMPOSER_MEMORY_LIMIT=-1 && php -d memory_limit=-1 composer.phar <...>

linux:
export COMPOSER_MEMORY_LIMIT=-1 && php -d memory_limit=-1 composer.phar <...>

https://getcomposer.org/doc/articles/troubleshooti...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question