php - Composer 忽略 $COMPOSER_HOME

标签 php linux bash ubuntu composer-php

我为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 # 

最佳答案

使用这个 inseead:

export COMPOSER_HOME=/opt/composer

它使变量可用于子进程。

关于php - Composer 忽略 $COMPOSER_HOME,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29536551/

相关文章:

bash - Fedora 容器 No 'find' 命令可用

php - 记录错误,而不是显示它们,而是在 PHP 中显示 500 错误页面

javascript - 表单将 JavaScript 粘贴到数据库中

php - 如何根据月份并排显示两个html表格中的日期?

linux - 什么是私有(private)页面?

linux - 如何通过 cURL 使用 AMI?

linux - 如何删除 Mercurial 存储库

bash - awk: next 在函数内是非法的

php - Flash AS3图像处理和保存应用程序的技术要求

linux - Linux 下批量音乐目录重命名脚本/命令 (bash)