Composer killed while updating

I was running a small Digital Ocean server (512 MB RAM) for a side project and got to the problem that I could not use composer update after pushing changes related to the use of new packages.

Fortunately, I got into this that saved the day. I am sharing it, maybe it will save yours.

Depending on how many dependencies your project has, you may simply need more memory on your system. I’ve had to increase my virtual machine’s memory to at least 768mb in order to get composer update to work in some situations.

However, if you’re doing this on a live server, you shouldn’t be using composer update at all.

What you should do is:

  1. Run composer update in a local environment (either your physical machine, or a development virtual machine)
  2. Upload or git push the composer.lock file
  3. Run composer install on the live server

composer install will then read from the .lock file, fetching the exact same versions every time rather than finding the latest versions of every package. This makes your app less likely to break, and composer uses less memory.

Read more here: https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file

SourceĀ https://stackoverflow.com/a/20699258

If you like this and find it useful please consider sharing it! Cheers!Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn
 

C