安装Composer PHP Warning: copy(): SSL operation failed with code 1.

来源:互联网 发布:我的世界随机性知乎 编辑:程序博客网 时间:2024/06/16 11:10

报错信息

[root@localhost ~]# 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 1Warning: 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 1PHP Warning:  copy(): Failed to enable crypto in Command line code on line 1Warning: copy(): Failed to enable crypto in Command line code on line 1PHP Warning:  copy(https://install.phpcomposer.com/installer): failed to open stream: operation failed in Command line code on line 1Warning: copy(https://install.phpcomposer.com/installer): failed to open stream: operation failed in Command line code on line 1

解决方法

  • 应该是CA证书验证失败造成的错误,下载个CA证书
[root@localhost ~]# wget http://curl.haxx.se/ca/cacert.pem[root@localhost ~]# mv cacert.pem /usr/local/openssl/ssl/certs/cacert.pem[root@localhost ~]# vim /yourpath/php.ini
  • 修改cafile路径,保存
[openssl]; The location of a Certificate Authority (CA) file on the local filesystem; to use when verifying the identity of SSL/TLS peers. Most users should; not specify a value for this directive as PHP will attempt to use the; OS-managed cert stores in its absence. If specified, this value may still; be overridden on a per-stream basis via the "cafile" SSL stream context; option.;openssl.cafile=openssl.cafile=/usr/local/openssl/ssl/certs/cacert.pem
阅读全文
0 0
原创粉丝点击