Composer memory 🐘 PHP

Composer: PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted

Composer ran out of memory while resolving or installing dependencies.

Seen on: PHP

Meaning

Dependency resolution can need several GB on large projects, more than the CLI memory_limit or the server’s RAM allows.

Common causes

  • CLI memory_limit too low
  • Small VPS without swap
  • Composer 1 (much more memory hungry than Composer 2)
  • Running composer update on production

⚡ Quick fix

  1. COMPOSER_MEMORY_LIMIT=-1 composer install
  2. Upgrade to Composer 2: composer self-update --2
  3. Run composer update locally and commit composer.lock; only composer install on servers

Detailed fix by platform

Linux

  1. Add swap on small servers before installing

How to diagnose

  1. Command — install or update?
  2. Version — composer --version

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.