Composer Require Fails with Memory Exhaustion Error: "Allowed memory size of 1610612736 bytes exhausted"
To resolve the memory exhaustion error encountered while running "composer require hwi/oauth-bundle", investigate the following solutions:
-
Increase the PHP Memory Limit:
- Check the current memory limit using "php -r "echo ini_get('memory_limit').PHP_EOL;"".
- Modify the "memory_limit" value in "/etc/php5/cli/php.ini" (for Debian-like systems) to "-1" for unlimited memory or set an explicit value such as "2G".
-
Override Memory Limit with Command-Line Argument:
- Include "-d memory_limit=-1" in the composer command: "php -d memory_limit=-1 composer.phar require hwi/oauth-bundle php-http/guzzle6-adapter php-http/httplug-bundle".
-
Check PHP.ini Location:
- Execute "php --ini" to determine the locations of loaded php.ini files.
-
Temporary Solution:
- Use the "COMPOSER_MEMORY_LIMIT=-1 composer require hwi/oauth-bundle php-http/guzzle6-adapter php-http/httplug-bundle" command.
-
Simplified Solution:
- Run "COMPOSER_MEMORY_LIMIT=-1 composer require hwi/oauth-bundle php-http/guzzle6-adapter php-http/httplug-bundle" to override the memory limit.
The above is the detailed content of How to Fix 'Allowed memory size of 1610612736 bytes exhausted' Error in Composer Require?. For more information, please follow other related articles on the PHP Chinese website!