composer update/req Allowed memory size of bytes exhausted

运行composer require报错如下: 

PHP Fatal error:  Allowed memory size of 1610612736 bytes exhausted (tried to allocate 67108864 bytes)

Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.

通过上面提示composer链接,输出内存配置信息

php -r "echo ini_get('memory_limit').PHP_EOL;"

输出 128M

修改 php.ini文件中的内存配置, memory_limit = -1,

>sudo cp /private/etc/php.ini.default /private/etc/php.ini
>sudo vim /etc/php.ini

修改完之后,运行

php -r "echo ini_get('memory_limit').PHP_EOL;"

输出结果是: -1

修改完成,composer update/require运行正常

你可能感兴趣的:(osx/Unix/linux)