×

PHP Compose 安装依赖时内存不足的解决方法

2023-12-08 15:13:21 Falcon
PHP Fatal error:  Allowed memory size of 1610612736 bytes exhausted (tried to allocate 8192 bytes) in phar:///usr/bin/composer/src/Composer/DependencyResolver/GenericRule.php on line 36

Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 8192 bytes) in phar:///usr/bin/composer/src/Composer/DependencyResolver/GenericRule.php on line 36

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 Or just:

COMPOSER_MEMORY_LIMIT=-1 composer require hwi/oauth-bundle php-http/guzzle6-adapter php-http/httplug-bundle

本文收录于