Skip to content
PHP and Laravel3 min read

Fix the Composer memory limit error

PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted

Short answer

Composer ran out of memory while resolving dependencies, hitting either PHP's limit or your account's limit. The reliable fix is to run composer update on your own machine, commit composer.lock, and run composer install on the server, which needs far less memory.

ArabyHost teamLast updated: ShareWhatsAppXLinkedIn
Contents
  1. Causes
  2. How to fix it
  3. Prevention
  4. On ArabyHost

You’ll usually see this during composer update or composer require, and sometimes during composer install on a large project. 1610612736 is 1.5 GB: Composer raises PHP’s memory limit to that value at startup if it was lower. The memory-hungry step is dependency resolution, where Composer compares every allowed version of every package to find a set that works together.

The same problem can show up in other forms:

PHP Fatal error:  Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes)
proc_open(): fork failed - Cannot allocate memory
Killed

A bare Killed means the operating system or your account’s resource limit stopped the process, not PHP.

Causes

  • Running composer update on the server, which re-resolves every dependency from scratch.
  • Composer 1, which uses far more memory than Composer 2.
  • Loose constraints such as * or >=1.0, which widen the search.
  • A low memory_limit in the PHP CLI configuration.
  • The account’s memory cap: on shared hosting each account has its own resource limits (LVE), and the process is stopped when it reaches them, whatever memory_limit says.

How to fix it

  1. Check your version and current limit:
composer --version
php -r "echo ini_get('memory_limit');"

On 1.x, move to Composer 2: download composer.phar from the official site getcomposer.org into your folder and run it as php composer.phar.

  1. Install, don’t update, on the server. On your machine:
composer update
git add composer.json composer.lock
git commit -m "Update dependencies"

Then on the server:

composer install --no-dev --optimize-autoloader

install takes the versions pinned in composer.lock as they are, with no resolution step, so it needs a fraction of the memory.

  1. Lift PHP’s limit for one command if you really must update on the server:
COMPOSER_MEMORY_LIMIT=-1 composer update

This removes PHP’s cap but can’t exceed the memory the account actually has.

  1. Update one package instead of everything:
composer update laravel/framework -W

-W updates only that package and its dependencies, which shrinks the problem a lot.

  1. If you see Killed, don’t keep retrying. Update locally, commit composer.lock and run install, or upload a ready-made vendor folder if you have no SSH.

Prevention

  • Always commit composer.lock and never run update on the live server.
  • Use clear constraints such as ^11.0 rather than *.
  • Remove packages you no longer use with composer remove.
  • Make deployments run composer install --no-dev only, as in the Laravel deployment guide.

If your site itself, not Composer, shows a memory error, see Allowed memory size exhausted.

On ArabyHost

AI/Developer plans include Composer over SSH jailed in CageFS. Every account has its own resource limits (LVE), so a heavy composer update may be stopped; installing from the lock file is the dependable route. You can deploy from GitHub with cPanel Git Version Control and a .cpanel.yml that runs composer install --no-dev after each push, as shown in the Git deployment guide. Other plans have no SSH, so build vendor locally and upload it as a ZIP. If the cause isn’t clear, the Araby AI assistant reads your error log and explains the fix. Plan details are on the developers page.

FAQ

What does 1610612736 mean in the message?

It's 1.5 GB in bytes, the limit Composer raises PHP's memory to on its own when the configured limit is lower. Seeing it means dependency resolution needed even more than that.

Is COMPOSER_MEMORY_LIMIT=-1 safe?

It removes PHP's limit for that one command and changes nothing on the server. It doesn't create real memory, though: on a hosting account with resource limits the process can still be stopped with Killed.

Why does composer install work when composer update fails?

install reads exact versions from composer.lock, while update compares every allowed version of every package to find a compatible set. That comparison is what eats the memory.

Useful? Share it with someone who needs it:WhatsAppXLinkedIn

Read next

Ready to put your idea online?

Fast, isolated hosting, support that understands you, and an AI assistant that fixes problems with you.