【问题标题】:Composer install failed作曲家安装失败
【发布时间】:2018-06-22 20:11:37
【问题描述】:

我正在尝试使用PHP version 5.6.* 在我的Ubuntu 16.04 中安装作曲家。

我用过:curl -sS https://getcomposer.org/installer | php。但它给我的错误如下:

All settings correct for using Composer
Downloading...
The "https://getcomposer.org/versions" file could not be downloaded: failed to open stream: Connection refused
Retrying...
The "https://getcomposer.org/versions" 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
Retrying...
The "https://getcomposer.org/versions" 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
The download failed repeatedly, aborting.

我之前没有安装作曲家。

【问题讨论】:

    标签: php curl composer-php failed-installation


    【解决方案1】:

    我通过下载https://curl.haxx.se/ca/cacert.pem 并在我的etc/php/5.6/cli/php.inietc/php/5.6/apache2/php.ini 中提供它的路径解决了这个问题。

    然后在运行sudo service apache2 restart && sudo apt install composer 之后就可以正常工作了。

    【讨论】:

      【解决方案2】:

      打开终端并运行php -r "var_dump(openssl_get_cert_locations());"

      记下default_cert_file 的位置。它可能会说\usr\local\ssl\cert.pem 验证该文件是否存在。如果没有,请从 https://curl.haxx.se/ca/cacert.pem 下载 cacert.pem 文件,并将其放在 /usr/local/ssl 中的某个位置

      你现在有一个文件是usr/local/ssl/cacert.pem

      打开你的 php.ini 并添加文件的位置openssl.cafile=cacert.pem

      安装作曲家

      运行composer config --global cafile "/usr/local/ssl/cacert.pem"

      【讨论】:

        【解决方案3】:

        这看起来像是您主机上的 PHP/openssl 配置错误。

        我的工作站是 Ubuntu 16.04.3、php 7.0.22 和 openssl-1.0.2g - 安装程序运行良好。

        尝试禁用 TLS:

        curl -sS https://getcomposer.org/installer | php -- --disable-tls
        

        【讨论】:

        • 通过禁用 TLS 来“解决”这个问题绝对不符合发帖者问题的精神......
        【解决方案4】:

        我在使用 Laravel Homestead 时遇到了这个问题,因为我不小心清空了这个文件的内容:/etc/ssl/certs/ca-certificates.crt

        为我解决的问题是:

        sudo apt-get purge ca-certificates 
        sudo apt-get install ca-certificates
        

        感谢https://stackoverflow.com/a/53351370/470749

        【讨论】:

        • 谢谢,它为我解决了。在运行“sudo apt-get install ca-certificates”之前运行“sudo apt-get update”
        【解决方案5】:

        这是由我的卡巴斯基网络安全引起的 我通过暂时禁用 KIS 来修复它

        你可以试一试。

        【讨论】:

          【解决方案6】:

          将导出代理从 https 更改为 http

          打开终端

              echo $https_proxy
          // Change export proxy from 
              https_proxy=https://192.168.0.10:8080/
          // to 
             https_proxy=http://192.168.0.10:8080/
          

          cmd::https_proxy=http://192.168.0.10:8080/

          【讨论】:

            猜你喜欢
            • 2021-11-03
            • 2017-09-15
            • 2017-02-14
            • 2013-06-02
            • 2018-12-28
            • 2016-02-27
            • 1970-01-01
            • 2021-10-05
            相关资源
            最近更新 更多