Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ssquare's avatar

cURL error 60: SSL certificate problem: unable to get local issuer certificate (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)

I am trying to test make a call to an API and when I tried via postman with URL something like:

https://exampleapi.com/domains/availability?domain_names[]=dummydomains.com&domain_names[]=exampledomain.com

and two headers: Api-Request-Id, Api-Signature,

it does work, but now when I try using guzzle HTTP (laravel 8) as:

            $response = Http::withHeaders([
                'Api-Request-Id'    => self::getRequestId(),
                'Api-Signature'     => self::getSignature(),
            ])->retry(3, 100)->post(config('services.reseller.api_url').'/domains/availability', [
                'domain_names[]' => $domain_name
            ])->throw();
            $body = $response->body();
            dd($body);

It returning error as:

cURL error 60: SSL certificate problem: unable to get local issuer certificate (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://exampleapi.com/domains/availability

I am testing it on localhost and I am using ubuntu 20.04.

0 likes
10 replies
ssquare's avatar

i have downloaded cert and placed it at:

/usr/lib/ssl/certs/cacert.pem

and updated php.ini located at etc/php/7.4/apache2/php.ini as

curl.cainfo ="/usr/lib/ssl/certs/cacert.pem"

and then restarted apache2

but still, the same issue, did I miss something or might did something wrong?

Sinnbeck's avatar

@ssquare Check if the value is loaded by using phpinfo() in a php file placed in the public directory

ssquare's avatar

@Sinnbeck It's loaded like this. https://ibb.co/TrhYjK8

But still, it is showing the same error.

and, when I did this dd(openssl_get_cert_locations());

It shows as:

array:8 [▼
  "default_cert_file" => "/usr/lib/ssl/cert.pem"
  "default_cert_file_env" => "SSL_CERT_FILE"
  "default_cert_dir" => "/usr/lib/ssl/certs"
  "default_cert_dir_env" => "SSL_CERT_DIR"
  "default_private_dir" => "/usr/lib/ssl/private"
  "default_default_cert_area" => "/usr/lib/ssl"
  "ini_cafile" => ""
  "ini_capath" => ""
]

should I make any changes?

ssquare's avatar

@frankielee I have updated as follow:

curl.cainfo = "/etc/ssl/certs/cacert.pem"
openssl.cafile="/etc/ssl/certs/cacert.pem"
openssl.capath="/etc/ssl/certs/cacert.pem"

Now, when I hit dd(openssl_get_cert_locations()); its showing:

array:8 [▼
  "default_cert_file" => "/usr/lib/ssl/cert.pem"
  "default_cert_file_env" => "SSL_CERT_FILE"
  "default_cert_dir" => "/usr/lib/ssl/certs"
  "default_cert_dir_env" => "SSL_CERT_DIR"
  "default_private_dir" => "/usr/lib/ssl/private"
  "default_default_cert_area" => "/usr/lib/ssl"
  "ini_cafile" => "/etc/ssl/certs/cacert.pem"
  "ini_capath" => "/etc/ssl/certs/cacert.pem"
]

These two fields get updated ini_cafile, ini_capath, but still the same issue.

Please or to participate in this conversation.