I got php5.5 with composer installed in a vagrant VirtualBox environment.
When I try any composer's commands the following error appears randomly:
The following exception is caused by a lack of memory and not having swap configured
How can I get around this ?
It isn't a bug and fix it - To enable the swap you can use for example:
/bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
/sbin/mkswap /var/swap.1
/sbin/swapon /var/swap.1
Ref: https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors
Hope it will help you :)
Sometimes swap file has not enough memory for composer update, so create a new one:
(assuming existing /swapfile has 2G, create new /swapfile1 with 8G of your drive space)
$ sudo fallocate -l 8G /swapfile1
$ sudo chmod 600 /swapfile1
$ sudo mkswap /swapfile1
$ sudo swapon /swapfile1
after composer updated, you can remove it and keep only initial file:
$ sudo swapoff /swapfile1
$ sudo rm /swapfile1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With