LoginSignup
13
16

More than 5 years have passed since last update.

[PHP] composerのPROXY設定

Posted at

世によく言われているHTTP_PROXY_REQUEST_FULLURIの設定が異なっていて、すごくはまった。

失敗時

環境変数

HTTP_PROXY=http://proxy-host:proxy-port/
HTTP_PROXY_REQUEST_FULLURI=0
HTTPS_PROXY=http://proxy-host:proxy-port/
HTTPS_PROXY_REQUEST_FULLURI=0

composerのチェック

$ composer diagnose
Checking composer.json: OK
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: FAIL
[Composer\Downloader\TransportException] The "http://packagist.org/packages.json" file could not be downloaded (HTTP/1.0 400 Bad Request)
Checking https connectivity to packagist: OK
Checking HTTP proxy: OK
Checking HTTP proxy support for request_fulluri: FAIL
Unable to assess the situation, maybe packagist.org is down (The "http://packagist.org/packages.json" file could not be downloaded (HTTP/1.0 400 Bad Request))
Checking HTTPS proxy support for request_fulluri: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking composer version: OK

httpsは成功するのに、httpが失敗する!

成功時

環境変数

HTTP_PROXY=http://proxy-host:proxy-port/
HTTP_PROXY_REQUEST_FULLURI=1
HTTPS_PROXY=http://proxy-host:proxy-port/
HTTPS_PROXY_REQUEST_FULLURI=0

HTTP_PROXY_REQUEST_FULLURItrueにする

composerのチェック

$ composer diagnose
Checking composer.json: OK
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking HTTP proxy: OK
Checking HTTP proxy support for request_fulluri: OK
Checking HTTPS proxy support for request_fulluri: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking composer version: OK

ようやくできた。

13
16
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
16