file_put_contents(config.json):无法打开流:没有这样的文件或目录
Posted
技术标签:
【中文标题】file_put_contents(config.json):无法打开流:没有这样的文件或目录【英文标题】:file_put_contents(config.json): failed to open stream: No such file or directory 【发布时间】:2014-09-05 05:19:30 【问题描述】:我正在尝试使用私有存储库更新作曲家:
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
我的用户不允许写入此目录/srv/data/
。
我的问题是如何更改config.json
目录?
我试过了:
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]
【问题讨论】:
Composer: file_put_contents(./composer.json): failed to open stream: Permission denied的可能重复 【参考方案1】:您可以使用COMPOSER_HOME
环境变量更改作曲家目录的位置。
COMPOSER_HOME=/some/writable/path php composer.phar update
【讨论】:
以上是关于file_put_contents(config.json):无法打开流:没有这样的文件或目录的主要内容,如果未能解决你的问题,请参考以下文章
file_put_contents执行返回false,file_put_contents false(linux服务器httpd)
详解PHP file_put_contents() 函数用法示例