Attempting to install HWIOAuthBundle using composer require leads to an out-of-memory error:
PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 67108864 bytes)
despite increasing the memory_limit in php.ini to 2GB.
To resolve this issue, try the following steps:
Run the command:
php -r "echo ini_get('memory_limit').PHP_EOL;"
Modify the php.ini file (e.g., /etc/php5/cli/php.ini for Debian-like systems) and set:
memory_limit = -1
Use the command-line argument to increase the limit:
php -d memory_limit=-1 composer.phar require hwi/oauth-bundle php-http/guzzle6-adapter php-http/httplug-bundle
To locate loaded php.ini files, run:
php --ini
Set the COMPOSER_MEMORY_LIMIT environment variable:
COMPOSER_MEMORY_LIMIT=-1 composer require hwi/oauth-bundle php-http/guzzle6-adapter php-http/httplug-bundle
The above is the detailed content of How to Fix Composer 'Allowed Memory Size Exhausted' Error During Package Installation?. For more information, please follow other related articles on the PHP Chinese website!