composer安装SSL证书异常处理
composer安装SSL证书异常处理,报错信息:error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
最近发现composer的传统安装方式不行了
传统方式
curl --insecure -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
主要是,执行
curl --insecure -sS https://getcomposer.org/installer | php
报错。
有的时候报错
All settings correct for using Composer
Downloading...
Failed to decode zlib stream
有的时候报错
All settings correct for using Composer
Downloading...
The "https://getcomposer.org/versions" file could not be downloaded: SSL operation failed with code 1. Open
SSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
Failed to enable crypto
failed to open stream: operation failed
Retrying...
The "https://getcomposer.org/versions" file could not be downloaded: SSL operation failed with code 1. Open
SSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
Failed to enable crypto
failed to open stream: operation failed
Retrying...
The "https://getcomposer.org/versions" file could not be downloaded: SSL operation failed with code 1. Open
SSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
Failed to enable crypto
failed to open stream: operation failed
The download failed repeatedly, aborting.
使用
curl --insecure -ksS https://getcomposer.org/installer | php
也不行,依然报错
All settings correct for using Composer
Downloading...
The "https://getcomposer.org/versions" file could not be downloaded: SSL operation failed with code 1. Open
SSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
Failed to enable crypto
failed to open stream: operation failed
Retrying...
The "https://getcomposer.org/versions" file could not be downloaded: SSL operation failed with code 1. Open
SSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
Failed to enable crypto
failed to open stream: operation failed
Retrying...
The "https://getcomposer.org/versions" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
Failed to enable crypto
failed to open stream: operation failed
The download failed repeatedly, aborting.
执行
php -r "copy('https://install.phpcomposer.com/installer', 'composer-setup.php');"
也不行。
可能是我服务器的证书问题,具体原因不详,具体解决方案如下
wget --no-check-certificate https://install.phpcomposer.com/installer -O ./composer-setup.php
下载安装文件,再下载证书文件
wget https://curl.haxx.se/ca/cacert.pem --no-check-certificate -O ./cacert.pem
修改php.ini中的openssl.cafile配置
vi /usr/local/lib/php.ini
修改为
openssl.cafile=/root/cacert.pem
退出修改在执行
php composer-setup.php
就可以安装成功了
版权声明
由 durban创作并维护的 Gowhich博客采用创作共用保留署名-非商业-禁止演绎4.0国际许可证。
本文首发于 博客( https://www.gowhich.com ),版权所有,侵权必究。
版权声明
由 durban创作并维护的 Gowhich博客采用创作共用保留署名-非商业-禁止演绎4.0国际许可证。
本文首发于 Gowhich博客( https://www.gowhich.com ),版权所有,侵权必究。