Composer 2.2 在使用 7.3 时在使用 7.3 以下的 PHP 时出现错误,但无论如何都不需要它

Composer 2.2 gives error on using PHP below 7.3 when it is using 7.3 but shouldnt need it anyway

提问人:Loom 提问时间:11/7/2023 最后编辑:Loom 更新时间:11/9/2023 访问量:72

问:

在 CentOS 7 上(公司框,因此无法更改)。Laravel 版本上周停止使用 Composer 1。 升级到 Composer 2.3 并升级到 PHP 7.3。 开始获得以下内容:

“低于 7.3.0 的 PHP 版本不支持使用 curl 连接到安全代理。”

这令人困惑,因为 7.3 已安装并确认 composer 正在使用它。

假设问题实际上是 CURL 版本(有 7.29、7.5 支持安全卷曲),因此安装了支持 PHP < 7.3 的 Composer 2.2。

但现在出现同样的错误: “低于 7.3.0 的 PHP 版本不支持使用 curl 连接到安全代理。”

这很令人困惑,因为 Composer 2.2 不需要 PHP 7.3

composer 诊断输出:

$ composer diagnose
Checking composer.json: WARNING
require.tymon/jwt-auth : exact version constraints (1.0.0-rc.5) should be avoided if the package follows semantic versioning
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: FAIL
[Composer\Downloader\TransportException] Connecting to a secure proxy using curl is not supported on PHP versions below 7.3.0.
Checking https connectivity to packagist: FAIL                                                                                                                                                 
[Composer\Downloader\TransportException] Connecting to a secure proxy using curl is not supported on PHP versions below 7.3.0.                                                                 
Checking HTTP proxy: FAIL                                                                                                                                                                      
[Composer\Downloader\TransportException] Connecting to a secure proxy using curl is not supported on PHP versions below 7.3.0.                                                                 
Checking github.com rate limit: FAIL                                                                                                                                                           
[Composer\Downloader\TransportException] Connecting to a secure proxy using curl is not supported on PHP versions below 7.3.0.                                                                 
Checking disk free space: OK                                                                                                                                                                   
Checking pubkeys:                                                                                                                                                                              
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0  87719BA6 8F3BB723 4E5D42D0 84A14642                                                                                          
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B  0C708369 153E328C AD90147D AFE50952                                                                                           
OK                                                                                                                                                                                             
Checking composer version: FAIL
[Composer\Downloader\TransportException] Connecting to a secure proxy using curl is not supported on PHP versions below 7.3.0.
Composer version: 2.2.2
PHP version: 7.3.33
PHP binary path: /usr/bin/php
OpenSSL version: OpenSSL 1.0.2k  26 Jan 2017
cURL version: 7.29.0 libz 1.2.7 ssl NSS/3.53.1
zip: extension present, unzip present, 7-Zip not available

谁能对此有所了解?我在建造时死在水里了。

谢谢

CentOS 7,在企业代理后面

php centos7 laravel-6

评论

1赞 Alex Howansky 11/7/2023
“已升级到 PHP 7.3”听起来您安装了 7.2 并且 composer 仍在使用它。发布 的输出。composer diagnose
0赞 Loom 11/7/2023
我验证它使用的是 7.3,但无论如何都不需要它。将 composer 诊断输出添加到帖子中。
1赞 Alex Howansky 11/7/2023
请参阅此问题“curl 需要 CURL_VERSION_HTTPS_PROXY 功能(在 curl 7.52.0 中添加,2016 年 12 月)。这个常量是在 PHP 7.3 中添加的,它允许检查这个功能。因此,看起来“7.3.0 以下的 PHP 版本不支持”的措辞不太准确,应该“7.52.0 以下的 cURL 版本不支持”。你是从源代码安装PHP的吗?
0赞 Loom 11/7/2023
使用 yum 安装了 PHP。我担心在 CentOS 7.5 上安装 cURL 7。
0赞 Alex Howansky 11/7/2023
你必须使用第三方的 PHP 软件库(可能是 Remi?),因为 Centos 7 通常附带 PHP 5.4。您可能需要降级到 PHP 7.2。

答:

0赞 Loom 11/9/2023 #1

虽然 Composer 2.2 支持 PHP 7.2,但需要 cURL 7.52。 CentOS 7 使用 cURL 7.29。 放弃尝试使用 Composer 2.2 以避免 CentOS 7 上的 cURL 更新