platformsh/legacy-cli

Installer fails when behind proxy

Closed this issue · 5 comments

While trying to create a docker image with the CLI using the command

RUN curl -sS https://platform.sh/cli/installer | php

I got the following error:

Warning: file_get_contents(https://platform.sh/cli/manifest.json): failed to open stream: Unable to find the socket transport "http" - did you forget to enable it when you configured PHP? in Standard input code on line 355

A quick search pointed out that this was probably because of running behind a proxy, which made sense since this is indeed the case.

The composer installer seems to account for this:

// http(s):// is not supported in proxy
$proxyURL = str_replace(array('http://', 'https://'), array('tcp://', 'ssl://'), $proxyURL);

which seems to do the trick since

RUN curl -sS https://getcomposer.org/installer | php

(in the same dockerfile) works as expected.

Maybe something similar can be done here?

Hi @rokkie, thanks for this issue. If you have time, could you please test the installer in the PR above? it would be:

RUN curl -sfS https://raw.githubusercontent.com/pjcdawkins/platformsh-cli/proxy-replace-http/dist/installer.php | php

Maybe this fixes #952 as well

Good point - yes probably.

The installer change is now deployed. (thanks again for reporting and testing!)

Thanks for the quick response!