Composer - PHP Warning: proc_open(): fork failed - Cannot allocate memory
Asked Answered
F

2

5

I have a problem with composer, it has always worked well but now it doesn't want to...
Here is the result of a simple composer install command :

bob@SRV04:~/testdir$ composer install
Loading composer repositories with package information
Updating dependencies
Package operations: 44 installs, 0 updates, 0 removals
  - Installing psr/container (1.0.0): The following exception is caused by a 
lack of memory or swap, or not having swap configured
Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open- 
fork-failed-errors for details

PHP Warning:  proc_open(): fork failed - Cannot allocate memory in 
phar:///bin/composer/vendor/symfony/console/Application.php on line 952

Warning: proc_open(): fork failed - Cannot allocate memory in 
phar:///bin/composer/vendor/symfony/console/Application.php on line 952

[ErrorException]
proc_open(): fork failed - Cannot allocate memory

The problem is, given the state of my memory, everything should work.

free -h
             total       used       free     shared    buffers     cached
Mem:          7,8G       3,4G       4,4G       131M       207M       503M
-/+ buffers/cache:       2,7G       5,1G
Swap:         1,7G       728M       971M
  • I updated everything I could update
  • php.ini memory is set to -1

I saw that there are several other questions that resemble this problem but none of them propose a solution that fixes the bug

Footpace answered 24/6, 2019 at 8:1 Comment(0)
F
8
COMPOSER_MEMORY_LIMIT=-1 composer update

that little extra command saved my life on my old server.

Footpace answered 3/6, 2020 at 10:28 Comment(0)
P
-1

@arno this started happening to me today as well, running composer require. I followed the steps provided by composer and updated my swapfile. This worked for me.

https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04

Payson answered 27/6, 2019 at 19:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.