如何解决Laravel安装时MAC操作系统上的curl证书问题


安装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抛出以下错误

[ComposerDownloaderTransportException]                                                                                               
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(xamp-osx-5.6-3-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。

在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

相关内容

  • 没有找到相关文章

最新更新