0

I am trying to update composer with private repositories:

php composer.phar update

An existing OAuth token for Composer is present and will be reused [ErrorException] file_put_contents(/srv/data/.composer/config.json): failed to open stream: No such file or directory

My user is not allowed to write into this directory /srv/data/.

My question is how to change config.json directory?

I have tried:

 php.composer.phar config --list

 [repositories.0.type] vcs
 [repositories.0.url] https://github.com/*****/*******.git
 [repositories.packagist.type] composer
 [repositories.packagist.url] https?://packagist.org
 [repositories.packagist.allow_ssl_downgrade] true
 [process-timeout] 300
 [use-include-path] false
 [preferred-install] auto
 [notify-on-install] true
 [github-protocols] [git, https, ssh]
 [vendor-dir] vendor
 [bin-dir] bin
 [cache-dir] /srv/data/.composer/cache
 [cache-files-dir] {$cache-dir}/files (/srv/data/.composer/cache/files)
 [cache-repo-dir] {$cache-dir}/repo (/srv/data/.composer/cache/repo)
 [cache-vcs-dir] {$cache-dir}/vcs (/srv/data/.composer/cache/vcs)
 [cache-ttl] 15552000
 [cache-files-ttl] 15552000
 [cache-files-maxsize] 300MiB (314572800)
 [discard-changes] false
 [autoloader-suffix]
 [optimize-autoloader] false
 [prepend-autoloader] true
 [github-domains] [github.com]
 [store-auths] prompt
 [home] /srv/data/.composer

 php composer.phar config home  /srv/data/web/vhsots/monsiteweb/
 [InvalidArgumentException]
 Setting home does not exist or is not supported by this command
 config [-g|--global] [-e|--editor] [-a|--auth] [--unset] [-l|--list] [-f|--file="..."]    [setting-key] [setting-value1] ... [setting-valueN]
kenorb
  • 155,785
  • 88
  • 678
  • 743
bingo
  • 150
  • 3
  • 10
  • Possible duplicate of [Composer: file\_put\_contents(./composer.json): failed to open stream: Permission denied](https://stackoverflow.com/questions/41212362/composer-file-put-contents-composer-json-failed-to-open-stream-permission) – kenorb Mar 22 '18 at 14:50

1 Answers1

1

You can change the location of the composer directory with the COMPOSER_HOME environment variable.

COMPOSER_HOME=/some/writable/path php composer.phar update
Steve Buzonas
  • 5,300
  • 1
  • 33
  • 55