Skip to content

Instantly share code, notes, and snippets.

@ozh
Created March 24, 2014 23:30
Show Gist options
  • Select an option

  • Save ozh/9751639 to your computer and use it in GitHub Desktop.

Select an option

Save ozh/9751639 to your computer and use it in GitHub Desktop.
Using Composer behind a proxy

Define the proxy in the CLI :

$ export https_proxy='87.248.188.202:8080'
$ export http_proxy='87.248.188.202:8080'

Check proxy :

$ curl https://icanhazip.com
87.248.188.202

$ curl http://icanhazip.com
87.248.188.202

Install composer :

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

(alternative: just download https://getcomposer.org/composer.phar, duh)

Check composer :

$ php composer.phar diagnose
@ammarfrahm

ammarfrahm commented Feb 9, 2018

Copy link
Copy Markdown

In my case, i need to specify protocol and authentication credential in the environment variable.

$ export https_proxy='http://username:password@87.248.188.202:8080'
$ export http_proxy='http://username:password@87.248.188.202:8080

@shadyueh

Copy link
Copy Markdown

Thanx a lot! Forcing https_proxy to use http solved my problem.

@wagnermarques

wagnermarques commented Jun 24, 2020

Copy link
Copy Markdown

Hi guys,
I hope this is the right place to ask....

I think it is ok about be my composer is behind a proxy because composer diagnose says its ok...
But there are a problem "Cannot connect to HTTPS server through proxy "
I tryed to disable https but now works

Below is a print of this issue...

Best regards

composer-proxy-issue

@ozh

ozh commented Jun 24, 2020

Copy link
Copy Markdown
Author

@wagnermarques sorry man, this gist was notes I wrote down 6 years ago to solve a specific issue I had, I know nothing more than what is written here :)

@wagnermarques

Copy link
Copy Markdown

Ok, no problem... thanks...

@leandroximenes

Copy link
Copy Markdown

Thank you!!

I replace this :
php -r "readfile('https://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer \

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

in laravel sail

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment