Composer更新因OpenSSL错误而失败

时间:2017-07-31 10:13:35

标签: php composer-php

我正在使用WAMP 3.0.6(Apache 2.4.23,PHP 5.6.25)在Windows 10上工作,当我尝试运行composer update时 它用OpenSSL显示错误:

Loading composer repositories with package information
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 enable crypto
failed to open stream: operation failed
https://packagist.org could not be fully loaded, package information was loaded from the local cache and may be out of date
Updating dependencies (including require-dev)

我已经在c:\ wamp \ bin \ php \ php5.6.25 \ php.ini中设置了openssl.cafile变量,并确认CLI使用了这个php.ini文件。

php -r "var_dump(openssl_get_cert_locations());"

的输出
array(8) {
  ["default_cert_file"]=>
  string(25) "c:/usr/local/ssl/cert.pem"
  ["default_cert_file_env"]=>
  string(13) "SSL_CERT_FILE"
  ["default_cert_dir"]=>
  string(22) "c:/usr/local/ssl/certs"
  ["default_cert_dir_env"]=>
  string(12) "SSL_CERT_DIR"
  ["default_private_dir"]=>
  string(24) "c:/usr/local/ssl/private"
  ["default_default_cert_area"]=>
  string(16) "c:/usr/local/ssl"
  ["ini_cafile"]=>
  string(29) "c:/wamp/openssl/cacert.pem"
  ["ini_capath"]=>
  string(16) "c:/wamp/openssl/"
}

我从http://curl.haxx.se/ca/cacert.pem下载了证书文件,并尝试将其放在不同的位置:

c:/wamp/openssl/
c:/usr/local/ssl/certs
c:/usr/local/ssl/cert.pem

我尝试使用getcomposer.org中的composer-setup.exe重新安装composer,但它以相同的错误结束。

我搜索了stackoverflow并用谷歌搜索了几个小时但是任何可能的解决方案都没有用。我做错了什么?

1 个答案:

答案 0 :(得分:0)

尝试取消设置https_proxy使作曲家能够正常工作!