composer: OpenSSL Failed to enable crypto
Please, help. I cannot install my dependencies. WampServer Version 3.0.6 64bit Apache 2.4.23 - PHP 5.6.25 - MySQL 5.7.14 PHP 5.6.25 for CLI (Command-Line Interface)
[PHP Modules]
...bash
mysql
mysqli
mysqlnd
odbc
openssl
pcre
PDO
...
[Zend Modules]
Output of composer diagnose
:
Checking composer.json: OK
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0 87719BA6 8F3BB723 4E5D42D0
84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B 0C708369 153E328C AD90147D A
FE50952
OK
Checking composer version: OK
When I run this command:
$ composer require vlucas/phpdotenv
I get the following output:
Package operations: 1 install, 0 updates, 0 removals
- Installing vlucas/phpdotenv (v2.4.0): Downloading (connecting...)
Downloading (connecting...)
Downloading (connecting...)
Failed to download vlucas/phpdotenv from dist:
The "https://codeload.github.com/vlucas/phpdotenv/legacy.zip/3cc116adbe4b11be5ec557bf1d24dc5e3a21d18c" 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
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 27 (1 by maintainers)
Fixed by disable Kaspersky Antivirus
In my case, it was the CA Cert file that was the culprit
Open terminal and run
php -r "var_dump(openssl_get_cert_locations());"
Note the location of
default_cert_file
. It might say\usr\local\ssl\cert.pem
Verify that that file exists. If not, download the cacert.pem file from https://curl.haxx.se/ca/cacert.pem and place it in somewhere preferably in/usr/local/ssl
You now have a file is
usr/local/ssl/cacert.pem
Open your php.ini and add the location of the file
openssl.cafile=cacert.pem
Run
composer config --global cafile "/usr/local/ssl/cacert.pem"
@mzf More specifically, this issue is caused by Kaspersky AntiVirus scanning encrypted connections. This component can be disabled through
Settings > Additional > Network > Do not scan encrypted connections
.Thanks @jgmuchiri for pointing in the right direction.
If itβs of any use to others, I use valet+ 1.0.26, composer 1.8.4 OSX Movajes 10.14.3, php7.3 and simply specifying the cert composer looks for with:
composer config --global cafile "/usr/local/etc/openssl/cert.pem"
Fixed it for me.
F**k Kas. wast me a lot of times.
@mzf β¦ 3 hours wasted doing all sorts of different things. I wish I found your post first! Thanks!
NOTE: Ran in this issue again on a different computer. This is what fixed it for me: sudo apt-get install php-curl
I also disabled Kapersky, so it might be a combination of both.
It worked perfectly for me in Laravel Homestead. In my case I had to do this and reboot the machine. Now works perfectly.
Same issue π¦
[Composer\Downloader\TransportException] The βhttps://api.github.com/repos/ghunti/HighchartsPHP/zipball/548b321478510ec1559432a9baabbfba1a1e559aβ file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed Failed to enable crypto failed to open stream: operation failed