设为首页 加入收藏

TOP

安装Composer PHP Warning: copy(): SSL operation failed with code 1.
2017-10-10 08:31:57 】 浏览:8896
Tags:安装 Composer PHP Warning: copy SSL operation failed with code

报错信息

[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 1

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

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

Warning: 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
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇PHP万能的连接数据库 下一篇PHP+MySql+Bootstrap实现用户界面..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目