php - Composer self 更新在 OSX 上失败

标签 php macos openssl composer-php

在 OSX 系统上,安装了带有 PHP 5.6.3 的 XAMPP。

composer self-update

composer update

失败消息:

[Composer\Downloader\TransportException] 
The "https://getcomposer.org/version"; 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

openssl 安装或证书有问题。 我该如何解决这个问题?

最佳答案

我建议采取以下步骤:

  1. php.ini 中启用 OpenSSL 扩展 - extension=php_openssl.so
  2. 确保您在 php.ini 中配置了 SSL 证书

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

    如果缺少证书,请下载 http://curl.haxx.se/ca/cacert.pem并重命名为 ca-bundle.crt

修改 php.ini 后重新启动 PHP,并尝试再次运行您的 composer 命令。

关于php - Composer self 更新在 OSX 上失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29701431/

相关文章:

无法将类型 'UnsafePointer<Double>' 的值转换为预期的参数类型 'UnsafePointer<_>'

macos - Mac 中找不到包 'libcrypto'

ssl - 使用 OpenSSL S_Server 验证传入的 SSL

PHP - 来自 Mysql 的拉丁字符

php - 远程使用 MySqlDump 时 MySql 表锁定?

php - 如何解决执行查询时的数据库锁定问题

macos - KeyChain Security 命令行工具适用于 find-internet-passwords,但不适用于 find-generic-passwords

java - 使用 KeyStore.getEntry() 时出现 UnsupportedOperationException?

php - 如何解决 Laravel Composer 问题 - 您的需求无法解析为一组可安装的软件包

ssl - openSSL 1.1.1 API 疑点