X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=doc%2FComposer.md;h=02ce61639cda4fabaad0ba8ec4e55a6844d1d002;hb=512e58a7db8fed2e3a5347b3e3ef0098718f86fb;hp=d0e930e343c229f161aa19159a10ae578be5fe91;hpb=ee293f2ce28270e1f8e05ce38991977d41e40c27;p=friendica.git diff --git a/doc/Composer.md b/doc/Composer.md index d0e930e343..02ce61639c 100644 --- a/doc/Composer.md +++ b/doc/Composer.md @@ -95,4 +95,26 @@ 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] +```` + +## Related + +* [Class autoloading](help/autoloader) +* [How To Move Classes to `src`](help/Developer-How-To-Move-Classes-to-src)