The other day I tried to install the FOS User Bundle but I received the following error:
$ php composer . phar require friendsofsymfony / user - bundle "~2.0@dev"
./ composer . json has been updated
Loading composer repositories with package information
Updating dependencies ( including require - dev )
- Installing friendsofsymfony / user - bundle ( dev - master 16 b04c4 )
Cloning 16 b04c49af05dd3fb381e4abe04f0e5e231ac76d
Installation failed , reverting ./ composer . json to its original content .
The following exception is caused by a lack of memory and not having swap configured
Check https :// getcomposer . org / doc / articles / troubleshooting . md #proc-open-fork-failed-errors for details
PHP Fatal error : Uncaught exception 'ErrorException' with message 'proc_open(): fork failed - Cannot allocate memory' in phar :/// var / www / composer . phar / vendor / symfony / console / Application . php : 954
Stack trace :
#0 [internal function]: Composer\Util\ErrorHandler::handle(2, 'proc_open(): fo...', 'phar:///var/www...', 954, Array)
#1 phar:///var/www/composer.phar/vendor/symfony/console/Application.php(954): proc_open('stty -a | grep ...', Array, NULL, NULL, NULL, Array)
#2 phar:///var/www/composer.phar/vendor/symfony/console/Application.php(754): Symfony\Component\Console\Application->getSttyColumns()
#3 phar:///var/www/composer.phar/vendor/symfony/console/Application.php(715): Symfony\Component\Console\Application->getTerminalDimensions()
#4 phar:///var/www/composer.phar/vendor/symfony/console/Application.php(648): Symfony\Component\Console\Application->getTerminalWidth()
#5 phar:///var/www/composer.phar/vendor/symfony/console/Application.php(130): Symfony\Component\Console\Application->renderException(Object(ErrorException), Object in phar:///var/www/composer.phar/vendor/symfony/console/Application.php on line 954
Fatal error : Uncaught exception 'ErrorException' with message 'proc_open(): fork failed - Cannot allocate memory' in phar :/// var / www / composer . phar / vendor / symfony / console / Application . php : 954
Stack trace :
#0 [internal function]: Composer\Util\ErrorHandler::handle(2, 'proc_open(): fo...', 'phar:///var/www...', 954, Array)
#1 phar:///var/www/composer.phar/vendor/symfony/console/Application.php(954): proc_open('stty -a | grep ...', Array, NULL, NULL, NULL, Array)
#2 phar:///var/www/composer.phar/vendor/symfony/console/Application.php(754): Symfony\Component\Console\Application->getSttyColumns()
#3 phar:///var/www/composer.phar/vendor/symfony/console/Application.php(715): Symfony\Component\Console\Application->getTerminalDimensions()
#4 phar:///var/www/composer.phar/vendor/symfony/console/Application.php(648): Symfony\Component\Console\Application->getTerminalWidth()
#5 phar:///var/www/composer.phar/vendor/symfony/console/Application.php(130): Symfony\Component\Console\Application->renderException(Object(ErrorException), Object in phar:///var/www/composer.phar/vendor/symfony/console/Application.php on line 954
In order to solve this problem I had to setup a swap file:
$ sudo / bin / dd if =/ dev / zero of =/ var / swap . 1 bs = 1 M count = 1024
1024 + 0 records in
1024 + 0 records out
1073741824 bytes ( 1.1 GB ) copied , 1.54095 s , 697 MB / s
$ sudo / sbin / mkswap / var / swap . 1
Setting up swapspace version 1 , size = 1048572 KiB
no label , UUID = 035 dd6b9 - 2 ff5 - 4597 - bc7d - 3 f89f478e855
$ sudo / sbin / swapon / var / swap . 1