任何人都有遇到此错误的经验:
[301.7MB/151.72s] The following exception is caused by a lack of memory or swap, or not having swap configured
[301.7MB/151.72s] Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details
Warning: proc_open(): fork failed - Cannot allocate memory in phar:///usr/local/bin/composer.phar/vendor/symfony/console/Application.php on line 979
[ErrorException]
proc_open(): fork failed - Cannot allocate memory
我已经将内存限制设置为768M到1024M并且交换超过4GB左右但仍然遇到此问题。
free -m
total used free shared buff/cache available
Mem: 4184 1877 823 177 1482 1808
Swap: 5023 596 4427
php -r "echo ini_get('memory_limit').PHP_EOL;"
768M
甚至手动设置内存限制:
php -d extension=phar.so -d extension=xmlwriter.so -dmemory_limit=1024M /usr/local/bin/composer.phar --profile -vvv update