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
Here is the workaround that I found that works for me every time:
Make a swap and run composer command again. I hope it'll work for you.
Try
it's basically raising the swap memory
sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024 && sudo /sbin/mkswap /var/swap.1 && sudo /sbin/swapon /var/swap.1
edit php.ini file and increase memory_limit value.
will solve this issue.
I have faced the same issue. I am on a AWS Free Microinstance which has less memory. I always try one of the below options and it always works (Before all this please check if you have the latest version of composer installed)
or remove the contents of the vendor folder and try composer update.
The second option tries to update all the components, if there is no update, it picks up the package from the cache else picks up from the dist
Note: Please change the memory limit as per your choice.
or
Create a swap partition and try. Swap partition is the portion of the hard drive that linux uses as virtual memory when it runs out of physical memory. It's similar to the windows swap file only instead of using an actual file, linux uses a partition on the hard drive instead.
Hope this helps
Easy, type this commands:
rm -rf vendor/
rm -rf composer.lock
php composer install --prefer-dist
Should work for low memory machines