I have a php script which downloads the composer.phar.
After it has downloaded I run exec()
to install the packages.
Folder structure is
--ROOT
--public
--composer.josn
However, when I run
exec('php composer.phar install -d ' . dirname(__DIR__), $out, $return);
I get an output of:
array(5) {
[0]=>
string(39) "All settings correct for using Composer"
[1]=>
string(14) "Downloading..."
[2]=>
string(0) ""
[3]=>
string(80) "Composer successfully installed to: /var/www/projects/funny/public/composer.phar"
[4]=>
string(25) "Use it: php composer.phar"
}
And the vendor packages aren't installed.
Just to be clear. The phar archive has already been downloaded at this point so what is it downloading now? Also the size of the downloaded phar goes from 200k to 900k after this command is ran.
Heres the full code to download and install:
$composer_path = __DIR__ . '/composer.phar';
$ch = curl_init();
$fh = fopen($composer_path, 'x');
curl_setopt_array($ch, array(
CURLOPT_URL => 'https://getcomposer.org/installer',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_FILE => $fh
));
$output = curl_exec($ch);
curl_close($ch);
fclose($fh);
exec('php composer.phar install -d ' . dirname(__DIR__), $out, $return);
The above code is ran from a file within public