Ivan Aldavert

Make composer works on Digital Ocean

When we try to install/update some stuff with composer, anyway we put -1 memory (or +1000) it still not working, to solve this we can create a swap file.


Here is the trick:

free -m

mkdir -p /var/_swap_

cd /var/_swap_

#Here, 1M * 2000 ~= 2GB of swap memory

dd if=/dev/zero of=swapfile bs=1M count=2000

mkswap swapfile

swapon swapfile chmod 600 swapfile

echo "/var/_swap_/swapfile none swap sw 0 0" >> /etc/fstab

#cat /proc/meminfo

free -m