【问题标题】:How to solve the curl certificate issue on MAC OS on Laravel installation?如何解决 Laravel 安装时 MAC OS 上的 curl 证书问题?
【发布时间】:2015-06-29 19:53:36
【问题描述】:

安装 Laravel 时

$ composer global require "laravel/installer=~1.1"

收到此错误

The "https://packagist.org/packages.json" file could not be downloaded: no valid certs found cafile stream: `/usr/local/etc/openssl/cert.pem'
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

更新

命令composer self-update 也会抛出以下错误

[Composer\Downloader\TransportException]                                                                                               
  The "https://getcomposer.org/version" file could not be downloaded: no valid certs found cafile stream: `/usr/local/etc/openssl/cert.  
  pem'                                                                                                                                   
  Failed to enable crypto                                                                                                                
  failed to open stream: operation failed  

我在 OSX 10.9.5 中使用 XAMPP5.6.3 (xampp-osx-5.6.3-0-installer)

我从 curl 下载了证书但无法使用。

【问题讨论】:

    标签: php macos laravel curl composer-php


    【解决方案1】:

    问题已解决:

    1) 下载证书文件,如(使用 wget 下载很重要,因为复制粘贴 html 文件对我不起作用)

    $ brew install wget
    wget http://curl.haxx.se/ca/cacert.pem
    

    2) 复制文件并粘贴到以下目录(确保有读写权限)

    /Applications/XAMPP/xamppfiles/share/openssl/cacert.pem
    

    3)将以下行添加到php.ini

    openssl.cafile=/Applications/XAMPP/xamppfiles/share/openssl/cacert.pem
    

    4) 重启 Apache

    5) 运行命令composer global require "laravel/installer=~1.1" 将安装Larvel。

    【讨论】:

      【解决方案2】:

      在 Macosx 上 curl 可以在 cacert.pem 中安全下载:

      echo "Downloading cacert.pem..."
      curl -sSL http://curl.haxx.se/ca/cacert.pem >> cacert.pem
      mkdir -p /usr/local/etc/openssl/certs
      mv -v cacert.pem /usr/local/etc/openssl/certs
      

      更多关于 CA 文件引导

      brew info openssl
      

      【讨论】:

        猜你喜欢
        • 2023-02-07
        • 2020-09-14
        • 2018-07-27
        • 2022-06-16
        • 2014-08-15
        • 2021-12-22
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多