Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am create a simple charm to get my symfony2 webapp from git and deploy it on ec2.

After getting the source from git, I want to run composer to resolve dependencies but I keep getting this error:

INFO juju context.go:221 worker/uniter: HOOK   The HOME or COMPOSER_HOME environment variable must be set for composer to run correctly

I am running composer using below command inside my hooks/install script

juju-log "Running composer"
/usr/bin/php composer.phar install

I also tried

juju-log "Running composer"
COMPOSER_HOME=${app_dir};/bin/bash -c "/usr/bin/php composer.phar install"

How can I set HOME or COMPOSER_HOME so that this command can be executed?

share|improve this question
Please contact me (link in my profile page), I'd love to work with you on getting a symfony workflow in Ubuntu! – Jorge Castro Sep 12 '13 at 16:07
Sure @JorgeCastro, I will email you once my charm is complete. – Amit Sep 13 '13 at 5:51
up vote 15 down vote accepted

HOME isn't set in the Juju hooks, only a few environment variables are.

You should be able to just run

COMPOSER_HOME="/path/you/want/to/be/home" php composer.phar install

which will set the environment variable before executing php.

share|improve this answer
Thanks Marco. That worked. I was trying similar but was giving ; before php, that should have also worked. COMPOSER_HOME=${app_dir} ; /usr/bin/php composer.phar install – Amit Sep 13 '13 at 5:48
No, the ; won't make COMPOSER_HOME an environment variable, just a variable, You would need export COMPOSER_HOME=${app_dir}; the export makes it an environment variable. What I've done is just set it as an environment variable for just that command. – Marco Ceppi Sep 13 '13 at 12:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.