Answer the question
In order to leave comments, you need to log in
How to run composer install c bash script?
It is necessary to automatically deploy sites, i.e. merge with git
and install dependencies, import the base, etc.
The problem is when I try to install composer dependencies, as a result, nothing is displayed on the screen.
If you do any of the options manually, everything works, even when I specify incorrectly -d, it swears
<?php
exec("sh create_site.sh $sitename", $output);
echo '<pre>';
print_r($output);
echo '</pre>';
?>
#!/usr/bin/env bash
#Вариант 1 - не работает
cd /var/www/demo-sites/site1
/usr/local/bin/composer install
#Вариант 2 - не работает
/usr/local/bin/composer install -d=/var/www/demo-sites/site1
#Вариант 3 - не работает
# скачал composer.phar и положил в папку
php composer.phar install -d=/var/www/demo-sites/site1
Answer the question
In order to leave comments, you need to log in
The problem was solved like this:
with the help of 2> & 1 I caught the error:
The HOME or COMPOSER_HOME environment variable must be set for composer to run correctly
# Composer install
COMPOSER_HOME="/usr/local/bin/composer" php /usr/local/bin/composer install --working-dir=/var/www/sites/$SITE_NAME 2>&1 || true
Should work with a global composer installation (it works for me):
cd /path/to/site
composer update
Correctly said above about the rights and paths.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question