5

我可以连接到 SSL 站点,通过 HTTPS 通过命令行安装作曲家。检查了 OPENSSL 版本SSL Version => OpenSSL/1.0.1j。那么问题出在哪里?想法?

这是原始输出。

[kunaaljain@localhost php]$ /opt/lampp/bin/php-5.6.3 composer.phar diagChecking composer.json: FAIL
the property name is required
the property description is required
No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity: FAIL
[Composer\Downloader\TransportException] The "https://packagist.org/packages.json" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
failed to open stream: Cannot connect to HTTPS server through proxy
Checking HTTP proxy: FAIL
[Composer\Downloader\TransportException] The "https://packagist.org/packages.json" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
failed to open stream: Cannot connect to HTTPS server through proxy
4

3 回答 3

2

这是 php > 5.6 的 OpenSSL 问题。Rob Allen 在这里使用自制软件进行了修复:http: //akrabat.com/ssl-certificate-verification-on-php-5-6/

在 github 上还有一个 Composer 的官方 issue: https ://github.com/composer/composer/issues/2798#issuecomment-68200214

编辑链接证书文件的 php.ini 应该可以修复它:

curl.cainfo=/full/path/to/ssl/certs/ca-bundle.crt
openssl.cafile=/full/path/to/ssl/certs/ca-bundle.crt

这个问题告诉你如何找到正确的路径: Composer update failed while updates from packagist

于 2015-03-15T16:00:55.307 回答
2

在我更新到OSX El Capitan并在我的开发环境中同时更新其他东西之后,我在我的 Mac 上遇到了同样的情况。

我花了半天时间调查,得出的结论是,原因在于openssl的证书已过时。解决方案是通过 bash 脚本从 Apple 的 Keychain 中提取证书:

    cert_file="$( openssl version -d | awk -F'"' '{print $2}' )/cert.pem"
    mkdir -p "${cert_file%/*}"
    security find-certificate -a -p /Library/Keychains/System.keychain > "$cert_file"
    security find-certificate -a -p /System/Library/Keychains/SystemRootCertificates.keychain >> "$cert_file"

如果之前没有手动弄乱openssl的配置,这在大多数情况下应该会有所帮助。需要简单的证书更新。

于 2015-12-10T02:04:56.240 回答
2

尝试在本地 vagrant 环境中运行 composer 时,我遇到了同样的问题。发现问题是系统时钟不同步引起的。

通过运行修复

  vagrant ssh
  sudo apt install ntpdate
  sudo ntpdate ntp.ubuntu.com
  sudo timedatectl set-ntp on
  sudo service ntp stop
  sudo ntpd -gq
  sudo service ntp start
于 2018-10-27T19:35:51.053 回答