Tag Archive: Linux

Composer update creates a lack of memory

While using Symfony 2 it’s common that you have to run the command composer update. Sometimes we’re graced with the error:

1
2
3
4
5
6
7
8
9
10
The following exception is caused by a lack of memory and not having swap configured

PHP Fatal error:  Uncaught exception 'ErrorException' with message 'proc_open(): fork failed - Cannot allocate memory' in phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:954
Stack trace:
#0 [internal function]: Composer\Util\ErrorHandler::handle(2, 'proc_open(): fo...', 'phar:///usr/loc...', 954, Array)
#1 phar:///usr/local/bin/composer/vendor/symfony/console/Application.php(954): proc_open('stty -a | grep ...', Array, NULL, NULL, NULL, Array)
#2 phar:///usr/local/bin/composer/vendor/symfony/console/Application.php(754): Symfony\Component\Console\Application->getSttyColumns()
#3 phar:///usr/local/bin/composer/vendor/symfony/console/Application.php(715): Symfony\Component\Console\Application->getTerminalDimensions()
#4 phar:///usr/local/bin/composer/vendor/symfony/console/Application.php(648): Symfony\Component\Console\Application->getTerminalWidth()
#5 phar:///usr/local/bin/composer/vendor/symfony/console/Application.php(130): Symfony\Component\Console\Application->renderException(Object(ErrorException),  in phar:///usr/local/bin/composer/vendor/symfony/console/Application.php on line 954

The easiest way to fix it it’s by creating a virtual swap partition using the following commands:

1
2
3
/bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
/sbin/mkswap /var/swap.1
/sbin/swapon /var/swap.1

Unix bash aliases

Well, I’m a little bored by, every time I change my system I have to update my aliases. So here it goes some alias that can be really useful. I gonna use this page to save all my aliases.

Both systems .bash_aliases:

1
2
3
4
alias duh ='du -h -d1'
alias ll  ='ls -lA --color'
alias l   ='ls -FhsSA1'
alias gpa ='for r in $(git remote); do git push $r master; done';

Linux .bash_aliases:

1
alias print ='echo -e'

MacOSX .bash_aliases:

1
alias print ='echo'

Linux .bash_colors:

1
2
3
4
RED   ='e[1;31m'
CYAN  ='e[1;36m'
GREEN ='e[1;32m'
NC    ='e[0m' # No Color

MacOSX .bash_colors:

1
2
3
4
RED   ='x1B[1;31m'
CYAN  ='x1B[1;36m'
GREEN ='x1B[1;32m'
NC    ='x1B[0m' # No Color