Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSL Error at Composer Install

While installing Composer to XAMPP, I got some errors. My system OS was Windows 7, how can I solve this and install Composer?

Download failed: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed file_get_contents(): Failed to enable crypto file_get_contents(https://getcomposer.org/composer.phar.sig): failed to open stream: operation failed Download failed: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed file_get_contents(): Failed to enable crypto file_get_contents(https://getcomposer.org/composer.phar.sig): failed to open stream: operation failed

like image 291
ranjith Avatar asked Feb 04 '16 09:02

ranjith


1 Answers

Make sure you configured the path to the ca certificates in php.ini:

curl.cainfo=/full/path/to/ssl/certs/ca-bundle.crt
openssl.cafile=/full/path/to/ssl/certs/ca-bundle.crt

In case you don't have a ca certificate bundle download it:

https://raw.githubusercontent.com/bagder/ca-bundle/master/ca-bundle.crt

To install Composer (without using cURL):

php -r "readfile('https://getcomposer.org/installer');" | php

Or, to install Composer (with cURL):

curl -sS https://getcomposer.org/installer | php

(If that doesn't work out, simple download the Composer PHAR via your browser.

https://getcomposer.org/composer.phar

But, you will run into the issue again, when fetching packages, until you fix the certificate issue.)

like image 156
Jens A. Koch Avatar answered Nov 16 '22 15:11

Jens A. Koch