Skip to content

Instantly share code, notes, and snippets.

@marcanuy
Created August 13, 2014 15:03
Show Gist options
  • Save marcanuy/68ef798f7ec6794d7483 to your computer and use it in GitHub Desktop.
Save marcanuy/68ef798f7ec6794d7483 to your computer and use it in GitHub Desktop.
Enable swap file in Linux. Also solves Composer error when low memory available: "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:981"
/bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
/sbin/mkswap /var/swap.1
/sbin/swapon /var/swap.1
#To enable it at the boot time, add the following entry into /etc/fstab:
/swapfile swap swap defaults 0 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment