From: Hypolite Petovan Date: Wed, 5 Apr 2017 00:34:06 +0000 (-0400) Subject: Add Composer FAQ X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b09553a71b2e91c562b3c28edb961229a36bbb07;p=friendica.git Add Composer FAQ --- diff --git a/doc/Composer.md b/doc/Composer.md index d0e930e343..8310baf3f0 100644 --- a/doc/Composer.md +++ b/doc/Composer.md @@ -95,4 +95,21 @@ If a package needs to be updated, whether to the next minor version or to the ne Then you should run `util/composer.phar update` to update it in your local `vendor` folder and update the `composer.lock` file that specifies the current versions of the dependencies. -Please note that you should commit both `composer.json` and `composer.lock` with your work every time you make a change to the former. \ No newline at end of file +Please note that you should commit both `composer.json` and `composer.lock` with your work every time you make a change to the former. + +## Composer FAQ + +### I used the `composer` command and got a warning about not to run it as root. + +See [https://getcomposer.org/root](). +Composer should be run as the web server user, usually `www-data` with Apache or `http` with nginx. +If you can't switch to the web server user using `su - [web user]`, you can directly run the Composer command with `sudo -u [web user]`. + +### Running Composer with `sudo` complains about not being able to create the composer cache directory in `/root/.composer` + +This is because `sudo` doesn't always change the `HOME` environment variable, which means that the command is run as the web server user but the system still uses `root` home directory. +However, you can temporarily change environment variable for the execution of a single command. +For Composer, this would be: +```` +$> COMPOSER_HOME=/var/tmp/composer sudo -u [web user] util/composer.phar [mode] +````