php 最新的 Composer 版本不拉 Laravel

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

Latest Composer version not pulling Laravel

phplaravelcomposer-php

提问by Shafiuzzaman

The Latest version of Composer is not pulling Laravel, I thought it could be because of Composer added new secure_http feature for downloading from Packagist and Laravel Packagist are in HTTP. This is what I think, so I need solution. The previous version of Composer doing well. The error showing on my terminal when I was trying to install Laravel installer, is:

Composer 的最新版本没有拉 Laravel,我认为可能是因为 Composer 添加了新的 secure_http 功能以便从 Packagist 下载,而 Laravel Packagist 是在 HTTP 中。这就是我的想法,所以我需要解决方案。以前版本的 Composer 做得很好。当我尝试安装 Laravel 安装程序时,终端上显示的错误是:

Failed to decode response: zlib_decode(): data error Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-modefor more info Your configuration does not allow connection to http://packagist.org. See https://getcomposer.org/doc/06-config.md#secure-httpfor details. http://packagist.orgcould not be fully loaded, package information was loaded from the local cache and may be out of date Installation failed, reverting ./composer.json to its original content. [Composer\Downloader\TransportException] Your configuration does not allow connection to http://packagist.org. See https://getcomposer.org/doc/06-config.md#secure-httpfor details.

无法解码响应:zlib_decode():数据错误以降级模式重试,查看https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode了解更多信息您的配置不允许连接到http:// packagist.org。有关详细信息,请参阅https://getcomposer.org/doc/06-config.md#secure-httphttp://packagist.org无法完全加载,包信息是从本地缓存加载的,可能已过期 安装失败,将 ./composer.json 恢复为原始内容。[Composer\Downloader\TransportException] 您的配置不允许连接到http://packagist.org。有关详细信息,请参阅https://getcomposer.org/doc/06-config.md#secure-http

回答by adetoola

I had the same problem. Found the solution here:Reddit Discussion of the issue

我有同样的问题。在这里找到了解决方案:Reddit 对问题的讨论

Basically, you have two options:

基本上,您有两种选择:

  • Revert to previous version, by running

    self-update --rollback

  • Or, downgrade composer by running

    composer config -g secure-http false

  • 通过运行恢复到以前的版本

    self-update --rollback

  • 或者,通过运行降级作曲家

    composer config -g secure-http false

回答by adnan dogar

at last this one saved me ,

最后这个救了我,

sudo composer self-update

sudo composer clear-cache

sudo composer config -g secure-http false

sudo composer update --no-scripts

finally done !

终于完成了 !

回答by Vasil Gerginski

When running (downgrade composer by running)

运行时(通过运行降级作曲家)

composer config -g secure-http false

i still got an exeption

我还有一个例外

Fatal error: Uncaught Error: Call to undefined method Composer\Package\RootPackage::getConfig() ...

I got a success finaly using additional --no-plugins

我最终使用额外的 --no-plugins 获得了成功

composer config -g secure-http false --no-plugins
composer self-update --no-plugins

Hope this helps anyone :)

希望这可以帮助任何人:)

回答by M at

I suggest to enable openssl using:

我建议使用以下方法启用 openssl:

composer config -g -- disable-tls false

composer config -g -- disable-tls false

And then you also need to active it in php.in

然后你还需要在 php.in 中激活它

Open php.ini and search for php_openssland you end up like this extension=php_openssl.dll

打开 php.ini 并搜索php_openssl,你最终是这样的extension=php_openssl.dll

The php_openssl.dllfile is in ext directory of your php so if you changed php directory and have an error like

php_openssl.dll文件位于 php 的 ext 目录中,因此如果您更改了 php 目录并出现类似错误

PHP Warning:  PHP Startup: Unable to load dynamic library 
'C:\php\ext\php_openssl.dll' - The specified module could not be found. 
in Unknown on line 0

You need to set extension=php_openssl.dllto extension="your php direcroty"\ext\php_openssl.dll

你需要设置extension=php_openssl.dllextension="your php direcroty"\ext\php_openssl.dll