【问题标题】:Composer "Download failed" Error作曲家“下载失败”错误
【发布时间】:2014-11-23 14:21:59
【问题描述】:

我在 Windows 中使用 xampp,我的 PHP 版本是 5.5.15 。 需要安装 composer 才能开始使用 laravel 框架。但是我的问题就在这里,当我想安装作曲家时,会遇到这个错误:

Download failed: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
file_get_contents(): Failed to enable crypto
file_get_contents(https://getcomposer.org/composer.phar): failed to open stream: operation failed
Download failed: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
file_get_contents(): Failed to enable crypto
file_get_contents(https://getcomposer.org/composer.phar): failed to open stream: operation failed
Download failed: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
file_get_contents(): Failed to enable crypto
file_get_contents(https://getcomposer.org/composer.phar): failed to open stream: operation failed
The download failed repeatedly, aborting.

我该怎么办? 有没有办法在不使用 composer 的情况下安装 laravel ?

【问题讨论】:

标签: php laravel composer-php


【解决方案1】:

如果您使用的是卡巴斯基,请尝试禁用加密连接扫描(或设置根据保护组件的请求扫描加密连接选项) 然后再试一次。

如果您有始终扫描加密连接,您可能会收到如下错误:

[Composer\Downloader\TransportException]
  The "https://packagist.org/packages.json" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
  error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed
  Failed to enable crypto
  failed to open stream: operation failed



[RuntimeException]
  Failed to clone https://github.com/doctrine/inflector.git via https, ssh protocols, aborting.
  - https://github.com/doctrine/inflector.git
    Cloning into 'C:\Users\User\my-project\vendor\doctrine\inflector'...
    fatal: unable to access 'https://github.com/doctrine/inflector.git/': SSL certificate problem: self signed certificate in certificate chain
  - git@github.com:doctrine/inflector.git
    Cloning into 'C:\Users\User\my-project\vendor\doctrine\inflector'...
    Host key verification failed.
    fatal: Could not read from remote repository.

    Please make sure you have the correct access rights
    and the repository exists.

【讨论】:

    【解决方案2】:

    您基本上必须将环境变量 SSL_CERT_FILE 设置为从以下链接下载的 ssl 证书的 PEM 文件的路径:http://curl.haxx.se/ca/cacert.pem。

    我花了很多时间才弄明白。

    详细答案可以看这里:https://stackoverflow.com/questions/34590842/cannot-install-composer-on-mac-os-x

    【讨论】:

    • 因为那个问题被删除了,你能提供一个详细的答案吗?
    【解决方案3】:

    因为你的电脑还没有安装 SSL 证书。

    首先,您应该下载一个全局 SSL 证书:

    wget http://curl.haxx.se/ca/cacert.pem
    

    然后,更新您的 php.ini 文件,添加以下行:

    openssl.cafile=/anywhere-you-like/cacert.pem
    

    祝你好运!

    【讨论】:

    • 据我所知,openssl.cafile php.ini 设置仅在 PHP 5.6 之后可用,因此我不会对 PHP 5.5 产生任何影响(OP 使用的是 5.5)
    猜你喜欢
    • 2014-06-16
    • 2020-04-13
    • 2018-05-08
    • 2020-05-11
    • 2018-06-22
    • 2016-10-31
    • 2018-12-19
    相关资源
    最近更新 更多