Skip to content

Instantly share code, notes, and snippets.

@appkr
Created June 25, 2018 10:59
Show Gist options
  • Save appkr/8cc2fa039c45fcdc97d64d29d45bbaee to your computer and use it in GitHub Desktop.
Save appkr/8cc2fa039c45fcdc97d64d29d45bbaee to your computer and use it in GitHub Desktop.
cURL error 77: error setting certificate verify locations

Problem

[2018-06-25 19:54:37] local.DEBUG: GuzzleHttp\Exception\RequestException: cURL error 77: error setting certificate verify locations:
  CAfile: /tmp/cacert.pem
  CApath: none (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) in /Users/appkr/meshkorea/korean-address-database-laravel/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:187

Docker

(host) $ docker exec -it <container-name> bash
  
(docker) $ mkdir -p /etc/ssl/certs
(docker) $ wget --no-check-certificate https://curl.haxx.se/ca/cacert.pem -O /etc/ssl/certs/ca-certificates.crt

MacOS

$ php --ini
Configuration File (php.ini) Path: /usr/local/etc/php/7.0
Loaded Configuration File:         /usr/local/etc/php/7.0/php.ini
Scan for additional .ini files in: /usr/local/etc/php/7.0/conf.d
Additional .ini files parsed:      /usr/local/etc/php/7.0/conf.d/curl.ini,
/usr/local/etc/php/7.0/conf.d/ext-opcache.ini
 
$ mkdir -p /etc/ssl/certs
$ sudo wget --no-check-certificate https://curl.haxx.se/ca/cacert.pem -O /etc/ssl/certs/ca-certificates.crt
 
$ sudo vim /usr/local/etc/php/7.0/conf.d/curl.ini
[curl]
curl.cainfo = /etc/ssl/certs/ca-certificates.crt
@Kambarov
Copy link

Hello, I tried what you wrote, but anyway I get same mistake. Can you help me in this situation? My error is:GuzzleHttp\Exception\RequestException
cURL error 77: error setting certificate verify locations: CAfile: /usr/local/etc/openssl/cert.pem CApath: /usr/local/etc/openssl@1.1/certs (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)

@tiagofrancafernandes
Copy link

I found this solution: guzzle/guzzle#1935 (comment)

Use 'verify => false'

$client = new Client([
      'base_uri'        => 'https://api.target'
      'verify'          => false, //https://github.com/guzzle/guzzle/issues/1935#issuecomment-629548739
      'headers'         => [
       //Your header here
  ]
]);

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