Skip to content
ecdsa.com
PHP ext-curl (Guzzle, Laravel HTTP client)PHP

Error message

cURL error 77: error setting certificate file: /etc/ssl/missing-ca.pem

Also printed as

  • error setting certificate file: /etc/ssl/missing-ca.pem

Guzzle formats it as "cURL error 77: error setting certificate file: <path> (see https://curl.se/libcurl/c/libcurl-errors.html) for <url>"; curl_error() returns the part after "cURL error 77: ". Guzzle's own verify option fails earlier, with "SSL CA bundle not found: <path>", when the file is missing.

PHP ext-curl (Guzzle, Laravel HTTP client) — CURLE_SSL_CACERT_BADFILE: curl.cainfo names a file that cannot be loaded

What it means

libcurl could not load the CA bundle PHP told it to use, so no HTTPS request through ext-curl can be made. The path after the colon usually comes from curl.cainfo in php.ini (or CURLOPT_CAINFO set by code). Nothing was sent to the server.

Why it happens

How to fix it

  1. 1.

    Find the setting and check the file

    php --ini and php -i show which file sets curl.cainfo; check that the path exists for the user running PHP (FPM may load another php.ini than the CLI).

    bash
    php --ini
    php -i | grep -E 'curl.cainfo|openssl.cafile'
    ls -l "$(php -r 'echo ini_get("curl.cainfo");')"
  2. 2.

    Point curl.cainfo at an existing bundle

    Use the distribution bundle on Linux or a maintained cacert.pem on Windows, and reload PHP-FPM or the web server.

    ini
    ; Linux (Debian/Ubuntu): the system bundle
    curl.cainfo = "/etc/ssl/certs/ca-certificates.crt"
    ; Windows: absolute path to an existing cacert.pem
    ; curl.cainfo = "C:\php\extras\ssl\cacert.pem"

Related errors

Browse the full signature error database