Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

milroy's avatar

lack of memory and not having swap configured

I just started working with Forge + Envoyer + DigitalOcian. I'm getting this error on envoyer while I'm trying to deploy one of my old Larave 4.2 projects.

Using global Composer installation.
Loading composer repositories with package information
Installing dependencies (including require-dev)
  - Installing symfony/translation (v2.5.12)
    Loading from cache
The following exception is caused by a lack of memory and not having swap configured
Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details

                                                     
  [ErrorException]                                   
  proc_open(): fork failed - Cannot allocate memory  

How can I fix this ..?

0 likes
2 replies
phileasfoggg's avatar

We use this handy Forge recipe:

if [ -f /swapfile ]; then
 echo "Swap file already exists."
else
 sudo fallocate -l 1G /swapfile
  sudo chmod 600 /swapfile
  sudo mkswap /swapfile
  sudo swapon /swapfile
  echo "/swapfile none swap sw 0 0" >> /etc/fstab
  echo "vm.swappiness=30" >> /etc/sysctl.conf
  echo "vm.vfs_cache_pressure=50" >> /etc/sysctl.conf
  echo "Swap created and added to /etc/fstab for boot up."
fi

Works a treat.

1 like

Please or to participate in this conversation.