php - 如何解决 Laravel 安装上 MAC OS 上的 curl 证书问题?

标签 php macos laravel curl composer-php

安装 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 下载了证书但没有用。

最佳答案

问题已解决:

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。

关于php - 如何解决 Laravel 安装上 MAC OS 上的 curl 证书问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29792786/

相关文章:

php - MySQL float 被意外舍入

php - HTML 表单文本输入到数组中

php - 更新后有一个空文件

ios - 在哪里可以找到有关 Mach 内核消息传递的良好文档

node.js - 跨环境/dist/index.js :42 unexpected token }

php - 使用 python 脚本 "Exit Code: 127(Command not found)"的 Laravel 任务计划

用于 Mac 上 Qt 的 MySQL

macos - Android Studio 内存不足

php - 为什么在 Laravel 中使用 Guard?

laravel 资源为每个项目问题传递多个参数