laravel 作曲家“下载失败”错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26095708/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 10:12:04  来源:igfitidea点击:

Composer "Download failed" Error

phplaravelcomposer-php

提问by noname27

i use xampp in Windows and my PHP Version is 5.5.15 . need to install composer for Start work with laravel framework. but my problem is here, when i want install composer, be faced with this error :

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

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.

What should I do? and is there a way to install laravel without using composer ?

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

回答by Kshitij Mittal

You basically have to set the environment variable SSL_CERT_FILE to the path of the PEM file of the ssl-certificate downloaded from the following link : http://curl.haxx.se/ca/cacert.pem.

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

It took me a lot of time to figure this out.

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

For a detailed answer, you can have a look here: https://stackoverflow.com/questions/34590842/cannot-install-composer-on-mac-os-x

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

回答by cespon

If you are using Kaspersky, try to disablethe Encrypted connection scanning(or set the Scan encrypted connections upon request from protection componentsoption) and try again.

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

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

If you have the Always scan encrypted connectionsyou can get errors like these:

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

[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
  - [email protected]: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.

回答by Haozhe Xie

Because you haven't installed SSL Certificate in your computer.

因为您还没有在您的计算机中安装 SSL 证书。

First of all, you should download a global SSL Certificate:

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

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

Then, update you php.inifile by appending following lines to it:

然后,通过向其附加以下行来更新php.ini文件:

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

Good luck!

祝你好运!