Skip to content

Instantly share code, notes, and snippets.

@djandyr
Last active December 10, 2016 15:54
Show Gist options
  • Save djandyr/d3901a5539862b622568 to your computer and use it in GitHub Desktop.
Save djandyr/d3901a5539862b622568 to your computer and use it in GitHub Desktop.
Composer SSL3_GET_SERVER_CERTIFICATE:certificate verify failed (PHP 5.6, MacOSX)

When using composer, the following error is displayed :

[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 

Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries. Therefore the certificate locations SSL_CERT_FILE and SSL_CERT_DIR have not been defined in PHP. This can be tested running the following :

php -r "print_r(openssl_get_cert_locations());"

To fix this issue, OpenSSL can be installed via homebrew.

  1. Install homebrew -- ruby -e "$(curl -fsSL --insecure https://raw.githubusercontent.com/Homebrew/install/master/install)"

  2. Install OpenSSL -- brew install openssl

  3. Add the following to your php.ini -- openssl.cafile=/usr/local/etc/openssl/cert.pem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment