Jump to content

Topic on Talk:Meza

Composer Error - Cannot allocate memory in phar

1
Summary by Revansx

admin must follow these instruction to temporarily add swap space to system prior to running a deploy

Revansx (talkcontribs)

During an initial deploy on a fresh new Centos7 AWS system we see the following error in the composer task:

PHP Fatal error: Uncaught exception 'ErrorException' with message 'proc_open(): fork failed - Cannot allocate memory' in phar

So we check available swap memory per:

free -m

which produces something like:

total used free shared buffers cached
Mem: 2048 357 1690 0 0 237
-/+ buffers/cache: 119 1928
Swap: 0 0 0

..and note that there is no swap memory so per: https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors

we sudo up to root (sudo -s) and run:

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

which temporarily creates swap space for composer to use.