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

feralheart's avatar

Composer is out of memory on AWS

I trying AWS free tier (after it's good I will migrate to it). When I wanted to install Laravel I got this error upon composer install:

PHP Fatal error: Out of memory (allocated 722477056) (tried to allocate 4096 bytes) in >/usr/share/php/Composer/DependencyResolver/RuleWatchGraph.php on line 52

I already increased the memory limit to 2GB in php.ini but it still drops this error

0 likes
2 replies
tuneless's avatar

This is why I've included /vendor in my git-repo :-P

I develop on local computer and commit all files. In deployment no need for composer install or update.

But u have to tweak your git for this step. I have no probs with that solution so far (2 years)

fideloper's avatar

How large is your aws server? If it only has 1gb of ram, setting the memory limit of 2gb in php.ini won't help.

If you can't/don't want to also increase the server side to get more RAM available, you can enable SWAP as well.

See here for how to enable swap. It enables 4gb, although I typically only do 1GB myself.

1 like

Please or to participate in this conversation.