I just can't solve this one.
I'm on Linode 1G RAM basic plan. Trying to install a package via Composer and it's not letting me. My memory limit is set to "-1" on PHP.ini
Is there anything else I can do to get this installed?
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing thujohn/rss (dev-master df80a7d)
Downloading: 100%
PHP Fatal error: Uncaught exception 'ErrorException' with message 'proc_open(): fork failed - Cannot allocate memory' in phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:975
Stack trace:
#0 [internal function]: Composer\Util\ErrorHandler::handle(2, 'proc_open(): fo...', 'phar:///usr/loc...', 975, Array)
#1 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(975): proc_open('stty -a | grep ...', Array, NULL, NULL, NULL, Array)
#2 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(853): Symfony\Component\Console\Application->getSttyColumns()
#3 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(818): Symfony\Component\Console\Application->getTerminalDimensions()
#4 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(752): Symfony\Component\Console\Application->getTerminalWidth()
#5 phar:///usr/local/bin/com in phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php on line 975
Fatal error: Uncaught exception 'ErrorException' with message 'proc_open(): fork failed - Cannot allocate memory' in phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:975
Stack trace:
#0 [internal function]: Composer\Util\ErrorHandler::handle(2, 'proc_open(): fo...', 'phar:///usr/loc...', 975, Array)
#1 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(975): proc_open('stty -a | grep ...', Array, NULL, NULL, NULL, Array)
#2 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(853): Symfony\Component\Console\Application->getSttyColumns()
#3 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(818): Symfony\Component\Console\Application->getTerminalDimensions()
#4 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(752): Symfony\Component\Console\Application->getTerminalWidth()
#5 phar:///usr/local/bin/com in phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php on line 975
Try that:
I increased the PHP
memory_limit
from the default 128M to 512M and restart the server. That solved the problem.I get into this situation most of the times so normally i used to follow the step of setting the swap memory.
But now i found a simple alternate trick which worked for me.
Run
composer update --no-dev
Other thancomposer update
have same problem with php composer.phar update on my 512mb hosting.
solved with php composer.phar install
I had a similar issue on the cheapest server (512MB RAM) hosted with DigitalOcean, and I was also running Jenkins CI on the same server. After I stopped the Jenkins instance the composer install command worked (well, to a point, it failed with the mcrypt extension missing besides already being installed!).
Maybe if you have another app running on the server, maybe its worth trying to stop it and re-running the command.
Here are the steps to fix the problem: (instant fast SWAP file allocation method used)
Server SWAP Setup (Ubuntu 16.04 SWAP to Fix Out of Memory Errors)
Check if you have swap already, memory and disk size:
Make swap file: (change 1G to 4G if you want 4GB SWAP memory)
Check swap file:
Assign Swap File:
Check if swap OK, memory and disk size:
Attach Swap File on System Restart:
Adjust Swap File Settings:
SWAP File Priority: (0-100% => 0: Don't put to swap, 100: Put on SWAP and free the RAM)
Remove inode from cache: (100: system removes inode information from the cache too quickly)