composer: OpenSSL Errors on Installation Instructions
Following the installer instructions, and running php composer-setup.php after Installer was verified, this was output:
All settings correct for using Composer
Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed in /Users/thelostspore/composer-setup.php on line 762
Warning: file_get_contents(): Failed to enable crypto in /Users/thelostspore/composer-setup.php on line 762
Warning: file_get_contents(https://getcomposer.org/versions): failed to open stream: operation failed in /Users/thelostspore/composer-setup.php on line 762
Warning: Invalid argument supplied for foreach() in /Users/thelostspore/composer-setup.php on line 508
None of the 0 stable version(s) of Composer matches your PHP version (5.5.34 / ID: 50534)
Could I be missing other requirements for installing composer?
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 30 (8 by maintainers)
Figured it out. Dug through the downloaded
composer-setup.phpsource and discovered this line ingetSystemCaRootBundlePathmethod body:I downloaded a cert bundle and set this directory for values in my php.ini (
/etc/php.ini).I set the env var
SSL_CERT_FILEto the path of the cert file and the openssl issues were resolved.I ran into the same issue with Homebrew and PHP 7.0.8.
I downloaded the cacert:
wget http://curl.haxx.se/ca/cacert.pemI then update the
openssl.cafilein thephp.inifile.I had the same issue and tried everything, including messing around with the certificate files.
Turned out to be Kapersky Antivirus…
Thanks to @marcovtwout on his comment on another thread
This is closed but leaving for others incase they land here -
If you’re on a Mac, fix is simple:
sudo mkdir -p /usr/local/libressl/etc/ssl/certssudo curl -o /usr/local/libressl/etc/ssl/cert.pem https://curl.haxx.se/ca/cacert.pemIn our office, 3/5 developers on our team have OpenSSL-related issues with Composer.
The failure messages do not provide any indication as to what the real issue is, and OpenSSL configuration is not listed as a system requirement.
How exactly could OpenSSL be broken or misconfigured for Composer, specifically? I don’t have OpenSSL related issues with any other OSS. I’m using the built-in system version that ships with ElCap (0.9.8zh), using default configuration.
Given that this has been an ongoing issue, I have two ideas - could the composer installation script attempt to check if OpenSSL configuration is “correct”? Perhaps the script could point the user to a wiki with instructions as to how to remedy their workstation if there are problems. Maybe a section in the troubleshooting article?
Is there anything out there that would help guide a user through these problems for Composer? It would be great if the
diagnosecommand provided more information as to the root cause(s). As of now, I’m unsure what will fix this issue.The real issue is that 99 out of 100 times, this is simply the result of a broken and/or improperly configured environment on the user side. There is nothing Composer can do to remedy this. So I am very reluctant with assigning the “bug” label to openssl related issues.