0%

windows에서 php composer 설치하기, OpenSSL Error messages 에러, error:0A000086:SSL

dotnet

windows에서 installer를 통하여 설치 설치

windows에서 아래 링크를 통해 composer setup exe파일을 다운받아 실행하였습니다.
https://getcomposer.org/Composer-Setup.exe
그런데, 설치중 아래와 같은 에러가 발생하였습니다.

1
2
3
4
5
6
7
8
9
The Composer installer script was not successful [exit code 1].

OpenSSL failed with a 'certificate verify failed' error. This indicates a problem with the Certificate Authority file(s) on your system, which either cannot be found or may be out of date.

Script Output:
The "https://getcomposer.org/versions" file could not be downloaded: preg_split(): Passing null to parameter #3 ($limit) of type int is deprecated
SSL operation failed with code 1. OpenSSL Error messages:
error:0A000086:SSL routines::certificate verify failed
Failed to open stream: Cannot connect to HTTPS server through proxy

proxy가 잘못되었다는둥, crt 파일이 잘못되었다는둥 여러 해결책들을 시도해보았으나, 모두 성공하지 못했습니다.

명령어로 composer 설치하기

  1. 아래 링크를 통해 파일을 다운 받은 후, installer -> composer-setup.php 으로 이름을 바꿉니다.
    https://getcomposer.org/installer

  2. 그 후, 아래 명령어로 composer 설치를 시도해보았습니다.

    1
    php composer-setup.php

    그러나 또 아래와 같은 에러가 발생하였습니다.

    1
    2
    3
    4
    5
    The "https://getcomposer.org/versions" file could not be downloaded: preg_split(): Passing null to parameter #3 ($limit) of type int is deprecated
    SSL operation failed with code 1. OpenSSL Error messages:
    error:0A000086:SSL routines::certificate verify failed
    Failed to open stream: Cannot connect to HTTPS server through proxy
    Retrying...

최종 해결책

  1. composer-setup.php의 파일 내용중 https로 되어있는 모든 부분을 http로 바꿔줍니다.
    composer

  2. 아래명령어를 실행해줍니다.

    1
    php composer-setup.php

그러면 이전과 다르게 아래와 같은 메시지가 뜨면서 정상적으로 install이 진행됩니다.

1
2
3
4
5
All settings correct for using Composer
Downloading...

Composer (version 2.6.3) successfully installed to: D:\Program Files\xampp\php\composer.phar
Use it: php composer.phar
  1. 앞선 명령창에 설명되어있는대로, 아래 명령어를 실행하면 설치가 됩니다.
    1
    php composer.phar

composer 의존성 설치 실패 - local issuer certificate

laravel을 설치하고 싶을경우, 아래와 같은 명령어를 사용하면 됩니다.

1
"D:\Program Files\xampp\php\php.exe" "D:\Program Files\xampp\php\composer.phar" create-project laravel/laravel:^9.0 example-app

그런데 또 아래와 같은 에러가 발생하더군요.

1
2
curl error 60 while downloading https://repo.packagist.org/packages.json: SSL certificate problem: unable to get lo
cal issuer certificate

이 경우에는,
C:\Users[사용자명]\AppData\Roaming\Composer\config.json 에 아래와 같이 config값을 설정해주어야 합니다.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{
"repositories": [
{
"type": "composer",
"url": "http://repo.packagist.org/packages.json",
"options": {
"ssl": {
"verify_peer": "true",
"verify_peer_name": "false"
}
}
}],
"config": {
"secure-http": false,
"disable-tls": true
}
}

그러고 다시 composer install 을 하면 정상적으로 수행됨을 확인할 수 있습니다.

총평

사내환경에서 proxy 설정을 사용하는데, 개발환경이 너무 안좋은거 같습니다.
구글링을 해도 해결하기가 어렵더군요.
composer.phar 의 소스를 보면서 어떻게든 해결법을 찾아내었지만,
새로운 개발환경을 도입하는것은 굉장히 어렵다고 생각이 들었습니다.
php의 경우는 제가 다니는 회사에서는 쓴 경우를 못 봐서 어려워도 상관없겠지만,
python이나 nodejs 같은 경우는 회사에서 많이 쓰는데도 불구하고 환경세팅이 굉장히 어렵게 되어 있습니다.
개발환경세팅을 힘들게 안하고도 쉽게 개발할 수 있는 시대가 오면 좋겠습니다.