【发布时间】: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