Home >Backend Development >PHP Tutorial >How to Fix Composer's 'Allowed memory size... exhausted' Error During Package Installation?
Attempting to install HWIOAuthBundle in your project using composer require results in an "Allowed memory size... exhausted" error. Despite increasing memory_limit to 2G in the php.ini file, the error persists.
To resolve this issue, you may try the following:
Adjust memory_limit in php.ini:
Increase the limit in the php.ini file (e.g., /etc/php5/cli/php.ini for Debian systems):
; Use -1 for unlimited or define an explicit value like 2G memory_limit = -1
Use a command-line argument:
php -d memory_limit=-1 composer.phar require hwi/oauth-bundle php-http/guzzle6-adapter php-http/httplug-bundle
Check loaded php.ini files:
php --ini
Quick fix options:
php composer.phar COMPOSER_MEMORY_LIMIT=-1 require hwi/oauth-bundle php-http/guzzle6-adapter php-http/httplug-bundle
or
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's 'Allowed memory size... exhausted' Error During Package Installation?. For more information, please follow other related articles on the PHP Chinese website!