0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【PHP】Composerのプロキシー設定を行う

Posted at

他に紹介していらっしゃる方もいますが、環境も変わっていそうなので。
備忘録も兼ねて。

環境

OS: CentOS Stream 9
PHP: 8.0.13
Composer: 2.4.4

プロキシー配下です。

エラー

パッケージのダウンロードで以下のエラーを吐きました。

curl error 28 while downloading https://repo.packagist.org/... : Failed to connect to
repo.packagist.org port 443: Connection timed out

composer diagnoseで疎通確認をしたところ、以下のような状態となりました。

$ composer diagnose
Checking composer.json: OK
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: FAIL
[Composer\Downloader\TransportException] curl error 28 while downloading http://repo.packagist.org/packages.json: Failed to connect to repo.packagist.org port 80: Connection timed out
Checking https connectivity to packagist: FAIL
[Composer\Downloader\TransportException] curl error 28 while downloading https://repo.packagist.org/packages.json: Failed to connect to repo.packagist.org port 443: Connection timed out
Checking github.com rate limit: FAIL
[Composer\Downloader\TransportException] curl error 28 while downloading https://api.github.com/rate_limit: Connection timed out after 10004 milliseconds  
...

悲しみです。

対処方法

プロキシー設定を変更しました。

$ sudo vi /etc/profile
PROXY='http[s]://<proxy_ip>'
export HTTP_PROXY=$PROXY
export HTTPS_PROXY=$PROXY
HTTP_PROXY_REQUEST_FULLURI=1
HTTPS_PROXY_REQUEST_FULLURI=0

$ source /etc/profile

composer diagnoseで疎通確認です。

$ 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
...

よさそうです。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?