Search code examples
composer-phppackagist

Submitting a package to packagist causing "composer_home env variable" error


Whenever I submit a git package to my packagist installation, I get the following error:

enter image description here

Uncaught Exception: [RuntimeException] The HOME or COMPOSER_HOME environment variable must be set for composer to run correctly

I've tried exporting the variable manually, but that doesn't seem to resolve the error.


Solution

  • The php user didn't have HOME or COMPOSER_HOME set, so I created a php.ini file in my web root with the following contents:

    auto_prepend_file = /home/yourusername/directory/set_environment.php

    I then created a set_environment.php file in the same directory, and set my COMPOSER_HOME directory.

    <?php putenv("COMPOSER_HOME=/home/etc/webapps/novuspackagist/.composer"); ?>

    Now, whenever the app is run, the COMPOSER_HOME environment variable will be set.