【问题标题】:Composer ignoring $COMPOSER_HOME作曲家忽略 $COMPOSER_HOME
【发布时间】:2015-06-14 16:53:38
【问题描述】:

我为 composer 设置了环境变量,但它仍然安装到默认目录 (~/.composer)。如果我做错了什么,谁能告诉我?

distPoint /var/www/html/laravel # COMPOSER_HOME="/opt/composer/"
distPoint /var/www/html/laravel # echo $COMPOSER_HOME
/opt/composer/
distPoint /var/www/html/laravel # composer global require "laravel/installer=~1.1"
Changed current directory to /root/.composer
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing symfony/process (v2.6.6)
    Downloading: 100%         

  - Installing symfony/console (v2.6.6)
    Downloading: 100%         

  - Installing guzzlehttp/streams (2.1.0)
    Downloading: 100%         

  - Installing guzzlehttp/guzzle (4.2.3)
    Downloading: 100%         

  - Installing laravel/installer (v1.2.0)
    Downloading: 100%         

symfony/console suggests installing symfony/event-dispatcher ()
symfony/console suggests installing psr/log (For using the console logger)
guzzlehttp/guzzle suggests installing ext-curl (Guzzle will use specific adapters if cURL is present)
Writing lock file
Generating autoload files
distPoint /var/www/html/laravel # ls ~/.composer/
cache  composer.json  composer.lock  vendor
distPoint /var/www/html/laravel # ls /opt/composer/
distPoint /var/www/html/laravel # 

【问题讨论】:

  • 您还需要export 环境变量。否则子进程将看不到它。 (例如,XDG_CONFIG_HOME 默认导出,因为这是平台兼容工具如今使用的。)

标签: php linux bash ubuntu composer-php


【解决方案1】:

使用这个inseead:

export COMPOSER_HOME=/opt/composer

它使变量可用于子进程。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-12-04
    • 2013-12-03
    • 2016-02-17
    • 2013-12-22
    • 1970-01-01
    • 1970-01-01
    • 2021-08-07
    相关资源
    最近更新 更多