Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 295
arno Avatar asked Jun 24 '19 08:06

arno


1 Answers

COMPOSER_MEMORY_LIMIT=-1 composer update

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

like image 72
arno Avatar answered Jan 04 '23 00:01

arno