php - composer.phar 与 nss 和 api.github.com 的问题

标签 php github composer-php nss sslv3

我正尝试在装有 RHEL6 的服务器上使用 composer.phar。

安装细节: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.3.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2 PHP 5.4.16 Zend Engine v2.4.0,版权所有 (c) 1998-2013 Zend Technologies

我的 composer.json 看起来像这样:

{
    "name" : "zendframework/skeleton-application",
    "description" : "Skeleton Application for ZF2",
    "keywords" : [
        "framework",
        "zf2"
    ],
    "homepage" : "https://something.com/",
    "require" : {
        "php" : ">=5.3.3",
        "zendframework/zendframework" : "2.*"
    }
}

运行 php composer.phar update 结果:

Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing zendframework/zendframework (2.2.5)
    Downloading: 100%
    Downloading: 100%
    Downloading: 100%



  [Composer\Downloader\TransportException]
  The "https://api.github.com/repos/zendframework/zf2/zipball/4a7cf6a4cf791244e14aa0ca49d1f06916b63202" file could not be downloaded: SSL: Connection reset by peer
  Failed to enable crypto
  failed to open stream: operation failed

下一步是尝试 curl :

$ curl -vvv "https://api.github.com/repos/zendframework/zf2/zipball/4a7cf6a4cf791244e14aa0ca49d1f06916b63202"
* About to connect() to api.github.com port 443 (#0)
*   Trying 192.30.252.139... connected
* Connected to api.github.com (192.30.252.139) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
*   CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
* NSS error -5961
* Closing connection #0
* SSL connect error
curl: (35) SSL connect error

强制 SSLV3 有效:

curl -3 -vvv "https://api.github.com/repos/zendframework/zf2/zipball/4a7cf6a4cf791244e14aa0ca49d1f06916b63202"
* About to connect() to api.github.com port 443 (#0)
*   Trying 192.30.252.138... connected
* Connected to api.github.com (192.30.252.138) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
*   CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
* SSL connection using SSL_RSA_WITH_RC4_128_SHA
* Server certificate:
*       subject: CN=*.github.com,O="GitHub, Inc.",L=San Francisco,ST=California,C=US
*       start date: Apr 30 00:00:00 2012 GMT
*       expire date: Jul 09 12:00:00 2014 GMT
*       common name: *.github.com
*       issuer: CN=DigiCert High Assurance CA-3,OU=www.digicert.com,O=DigiCert Inc,C=US
> GET /repos/zendframework/zf2/zipball/4a7cf6a4cf791244e14aa0ca49d1f06916b63202 HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.3.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: api.github.com

有没有人遇到过 composer.phar 的这个问题,并克服了它(并将分享他/她的解决方案:-))?我知道 Composer 使用 PHP 的 file_get_contents()。

最佳答案

这不是最好的解决方案,但为了节省时间,我解决了这个问题。我从错误输出中获取了 URL:

https://api.github.com/repos/zendframework/zf2/zipball/4a7cf6a4cf791244e14aa0ca49d1f06916b63202

我将其插入基于 Windows 的工作站上的浏览器中。在 RHEL6 机器上,在使用 composer 的用户的主目录中,有一个 .composer 目录。我将下载的 zip 文件放在这个目录中:

/home/composeruser/.composer/cache/files/zendframework/zendframework

然后我不得不将 zip 文件重命名为 url 中要求的名称(添加 zip 扩展名):

/home/composeruser/.composer/cache/files/zendframework/zendframework/4a7cf6a4cf791244e14aa0ca49d1f06916b63202.zip

下一次运行 composer 时,它使用缓存的文件,然后继续。如果有人想出一种方法来避免使用 NSS 在 RHEL6 机器上预缓存文件,请告诉我。

关于php - composer.phar 与 nss 和 api.github.com 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19801308/

相关文章:

Github:维持项目稳定的最佳方法是什么?

PyCharm 中的 Git 使用预先存在的存储库

github - 将更新从 azure 推送到 github

php - 删除迁移会导致异常

php - 为什么 PHP date ('m' , strtotime ('-1 months' )) 今天不能正常工作? 07/31

PHP 或 Linux Shell : Fastest way to reduce a text file to only have the last 10 characters

php - 如何解决外部包的composer包循环依赖?

php - Composer 使用 dockerfile 安装

php - Yii使用php代码而不是gii工具生成模型文件

php - 结合 angular js 和 php - 将数据插入数据库失败