laravel 配置不允许连接到 http://packagist.org/packages.json

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/38818464/
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 14:16:05  来源:igfitidea点击:

configuration does not allow connection to http://packagist.org/packages.json

phplaravelsslframeworkscomposer-php

提问by Jaimin

I am trying to install laravel in my computer.

我正在尝试在我的计算机上安装 Laravel。

I am refering to turorails pointlaravel installation tutorial.

我指的是turorails点laravel安装教程。

After installing composer trying to create new larael project but getting this error.

安装 Composer 后尝试创建新的 Larael 项目但收到此错误。

This is the error which I am getting:

这是我得到的错误:

采纳答案by Muhammad Sumon Molla Selim

You need to enable OpenSSL in your Windows.

您需要在 Windows 中启用 OpenSSL。

You can enable it from your php.inifile:

您可以从php.ini文件中启用它:

extension=php_openssl.dll

回答by Xiaowei Yang

Step 1: Set disable-tls = true
php composer.phar config -g disable-tls true
Step 2: Set secure-http = false
php composer.phar config -g secure-http false

The reason is: the url of the installation module is not https, reference manual:https://getcomposer.org/doc/06-config.md#disable-tls

原因是:安装模块的url不是https,参考手册:https: //getcomposer.org/doc/06-config.md#disable-tls

回答by Raymond

It works for me, try the step below :

它对我有用,请尝试以下步骤:

1 First clear the cached

1 先清除缓存

composer clear-cache

作曲家清除缓存

2 You have 2 options here:

2 这里有 2 个选项:

  1. enable OpenSSLin your php.ini :

    extension=php_openssl.dll

  2. disable TLS SSLoption for composer :

    composer config -g -- disable-tls true

  1. 在 php.ini 中启用OpenSSL

    扩展名=php_openssl.dll

  2. 为 composer禁用TLS SSL选项:

    composer config -g -- disable-tls true

3 Run again your laravelproject :

3 再次运行你的Laravel项目:

composer create-project laravel/laravel your-project-name --prefer-dist

composer create-project laravel/laravel your-project-name --prefer-dist

Hope those steps can help you.

希望这些步骤能帮到你。