Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing composer using vagrant, hhvm, and Ubuntu 14.04

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?

like image 460
cubiclewar Avatar asked May 05 '14 11:05

cubiclewar


People also ask

How to install composer cli on ubuntu?

To install composer globally, use the following command which will download and install Composer as a system-wide command named composer , under /usr/local/bin : sudo php /tmp/composer-setup. php --install-dir= /usr/local/bin --filename= composer.

How to install with composer?

Step 1: Navigate to the official composer website. Step 2: Then click on the Download button. Step 3: Then click on the Composer-Setup.exe & download the file. Step 4: Then click on “Install for all users”.

How do I check if Composer is installed in Linux?

Composer installation is really simple and can be done with a single command: curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer. To test your installation, run: composer.


1 Answers

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
like image 160
cubiclewar Avatar answered Oct 16 '22 12:10

cubiclewar