简体   繁体   中英

How to solve the curl certificate issue on MAC OS on Laravel installation?

While installing Laravel

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

Getting this error

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

UPDATE :

Also the command composer self-update throws the following error

[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  

I am using XAMPP5.6.3 (xampp-osx-5.6.3-0-installer) with OSX 10.9.5

I downloaded the certificate from curl but not working.

Issue solved:

1) Download the certificate file like (It is important to download using wget because copy paste the html file was not working for me)

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

2) Copy the file and paste to the following directory (Make sure the read write permission is there)

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

3)Add the following line to php.ini

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

4) Restart the Apache

5) Running the command composer global require "laravel/installer=~1.1" will install the Larvel.

On Macosx curl is fine to download safely in 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

More about CA file bootstrapping

brew info openssl

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM