Composer require runs out of memory. PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted
To get the current memory_limit value, run:
php -r "echo ini_get('memory_limit').PHP_EOL;"
Try increasing the limit in your php.ini
file (ex. /etc/php5/cli/php.ini
for Debian-like systems):
; Use -1 for unlimited or define an explicit value like 2G
memory_limit = -1
Or, you can increase the limit with a command-line argument:
php -d memory_limit=-1 composer.phar require hwi/oauth-bundle php-http/guzzle6-adapter php-http/httplug-bundle
To get loaded php.ini files location try:
php --ini
Another quick solution:
php composer.phar COMPOSER_MEMORY_LIMIT=-1 require hwi/oauth-bundle php-http/guzzle6-adapter php-http/httplug-bundle
In my case I was trying to require this package, and I was getting the PHP Fatal error: Allowed memory size of
.
I found it easy to run like this and you don't have to update the PHP INI file.
example: COMPOSER_MEMORY_LIMIT=-1 composer require huddledigital/zendesk-laravel
Hope this help someone.
Another solution from the manual:
Composer also respects a memory limit defined by the COMPOSER_MEMORY_LIMIT
environment variable:
COMPOSER_MEMORY_LIMIT=-1 composer.phar <...>
Or in my case
export COMPOSER_MEMORY_LIMIT=-1
composer <...>