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

nWidart's avatar

proc_open(): fork failed - Cannot allocate memory

Hi,

I've got a problem on Laravel Forge. I wanted to install my composer dependencies but for some weird reason it coudn't find "guzzlehttp/guzzle": "~4.0",. It showed the following error:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for guzzlehttp/guzzle 4.2.3 -> satisfiable by guzzlehttp/guzzle[4.2.3].
    - guzzlehttp/guzzle 4.2.3 requires guzzlehttp/streams ~2.1 -> no matching package found.

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.

Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

But locally I had no problem getting guzzle...

So I tried to remove the guzzle dependency on forge, and again composer install (I removed the composer.lock file), with the idea of installing guzzle back after the initial process. Only now the error I'm getting is :

Loading composer repositories with package information
Installing dependencies (including require-dev)
  - Installing nikic/php-parser (0.9.x-dev ef70767)
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:983

I've checked the memory_limit and it's set to 512M, I tried setting it a 1024M but still no luck.

Is there something to do to make this work?

Thanks

0 likes
10 replies
RemiC's avatar

I already had this issue with composer. Rebooting the VM fixed it.

nWidart's avatar

I just rebooted the server, the issue persists. :(

fideloper's avatar
Level 11

I think this is pretty common if there's not enough ram available - are you on a small server instance?

1 like
nWidart's avatar

Indeed @fideloper , the server had only 512mb ram. The client upped the server to one with 1gb ram and composer updated fine since then.

christopher's avatar

If you get the error "Cannot allocate memory" then it`s mostly an issue with not enough memory / ram

RemiC's avatar

Be sure to run a composer self-update. Last release has shown some significant improvements in performance/memory usage

srmklive's avatar

I had to enable swap on forge. I ran the following commands to get it working:

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

Remember to restart the server. Then try to run 'composer update' again

nimahkh's avatar

this command helped me ,

first check your swap with this command:

free -m

next increase it to 1024

sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024

sudo /sbin/mkswap /var/swap.1

sudo /sbin/swapon /var/swap.1

Please or to participate in this conversation.