安装composer提示PHPWarning:copy():SSLoperationfailedwithcode1.OpenSSLErrormessages:
(2022-10-14 14:49:17)分类: 技术 |
#php -r "copy('https://install.phpcomposer.com/installer',
'composer-setup.php');"
PHP Warning: copy(): SSL operation failed
with code 1. OpenSSL Error messages:
error:14090086:SSL
routines:ssl3_get_server_certificate:certificate verify failed in
Command line code on line 1
PHP Warning: copy(): Failed to enable crypto
in Command line code on line 1
PHP Warning:
copy(https://install.phpcomposer.com/installer): failed to open
stream: operation failed in Command line code on line 1
-----------------------------------
解决方案:
1、下载证书:
wget http://curl.haxx.se/ca/cacert.pem
或者
wget --no-check-certificate
http://curl.haxx.se/ca/cacert.pem
2、存放证书
mkdir -p /usr/local/openssl/certs
mv cacert.pem /usr/local/openssl/certs
3、改php.ini证书指向
4、重新安装composer即可