Installing composer using vagrant, hhvm, and Ubuntu 14.04
Asked Answered
E

2

5

At the end of my vagrant provisioning script I attempt to install composer using the following :

sudo curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer

However when this is executed I get the following errors :

SlowTimer [5612ms] at curl: https://getcomposer.org/composer.phar
Download failed: Failed to open https://getcomposer.org/composer.phar (Resolving timed out after 5613 milliseconds)
The download failed repeatedly, aborting.

If I have php installed rather than hhvm and run the same commands on my vagrant vm the install is successful which indicates an incompatibility in hhvm. However I also have a Linode running Ubuntu 14.04 and hhvm (no php) and can install composer using these commands without any problems.

Given I can install composer using a similar environment on my Linode why does it fail on my vagrant vm and how do I rectify this?

Etsukoetta answered 5/5, 2014 at 11:58 Comment(4)
Are you saying that despite having HHVM installed, and no PHP, you are able to call php on the command line, and it works? How did you do that? Apart from that, you could simply download the most recent version of composer.phar without using the download script because all it does is checking the local CLI PHP for sane .phar settings, which might lead to strange effects if done within the composer.phar itself if broken .phar settings apply (hen and egg problem).Catalase
Yes by default when hhvm is installed it is aliased to php so call php -v will give you an out like HipHop Virtual Machine 3.0.1. I will try bypassing the installer, however will still like to know what is causing the issue under vagrant.Etsukoetta
Can you wget https://getcomposer.org/installer ?Ampliate
@Ampliate just as you were writing that I tried that with success.Etsukoetta
E
8

As a work around until this gets fixed in vagrant, hhvm or where ever the root cause exisits you can download the composer installer using wget:

sudo wget https://getcomposer.org/installer

Then install composer using hhvm with some options to extend the timeouts as recommended here.

hhvm -v ResourceLimit.SocketDefaultTimeout=30 -v Http.SlowQueryThreshold=30000 installer

Then install composer globally as usual and clean up :

sudo mv composer.phar /usr/local/bin/composer
sudo rm installer
Etsukoetta answered 6/5, 2014 at 8:58 Comment(0)
B
1

the steps from composer.org

  1. $ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
  2. $ php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" notes hash changes every version of composer
  3. $ sudo apt-get install curl php-cli php-mbstring git unzip
  4. $ sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer

you have installed composer globally now, to verify just use the following command: $ composer -V

Brookebrooker answered 15/3, 2021 at 10:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.