Updating your Composer-based installation (e.g. Laravel) as root

On August 17, 2017 by aTutorMe

If you have root access to your web server (congratulations!) and you need to update your composer-based installation, e.g. Laravel, then you may get the following warning if you try to run composer update as root.

Take a read of https://getcomposer.org/root for more details.

 

Thanks to user Weboide’s answer on AskUbuntu Question 839107 I was able to run composer as www-data (the Apache user).

Steps:

  1. chsh www-data
  2. Enter the new value, or press ENTER for the default: /bin/bash
  3. su www-data
  4. run composer update in your Laravel directory