PHP Curl Error Code 60

PHP cURL error code 60

Use this certificate root certificate bundle:

https://curl.haxx.se/ca/cacert.pem

Copy this certificate bundle on your disk. And use this on php.ini

curl.cainfo = "path_to_cert\cacert.pem"

cURL error 60: SSL certificate: unable to get local issuer certificate

How to solve this problem:

  • download and extract cacert.pem following the instructions at https://curl.se/docs/caextract.html

  • save it on your filesystem somewhere (for example, XAMPP users might use C:\xampp\php\extras\ssl\cacert.pem)

  • in your php.ini, put this file location in the [curl] section (putting it in the [openssl] section is also a good idea):

[curl]
curl.cainfo = "C:\xampp\php\extras\ssl\cacert.pem"

[openssl]
openssl.cafile = "C:\xampp\php\extras\ssl\cacert.pem"
  • restart your webserver (e.g. Apache) and PHP FPM server if applicable

(Reference: https://laracasts.com/discuss/channels/general-discussion/curl-error-60-ssl-certificate-problem-unable-to-get-local-issuer-certificate)

Still same error display: cURL error 60: SSL certificate problem: unable to get local issuer certificate

How to solve this problem:

  • download and extract cacert.pem following the instructions at https://curl.se/docs/caextract.html

  • save it on your filesystem somewhere (for example, XAMPP users might use C:\xampp\php\extras\ssl\cacert.pem)

  • in your php.ini, put this file location in the [curl] section (putting it in the [openssl] section is also a good idea):

Example:

[curl]
curl.cainfo = "C:\xampp\php\extras\ssl\cacert.pem"

[openssl]
openssl.cafile = "C:\xampp\php\extras\ssl\cacert.pem"
  • restart your webserver (e.g. Apache) and PHP FPM server if applicable

reference here

You could also remove SSL validation on localhost. Just need to add options to de GuzzleHttp client in the 'withOptions' method to disable verification.

 $options = ['verify'=>false];

To check if a local environment can do a simple if:

public function authApi(){

$options = [];

if (App::environment('local')) {
$options = ['verify'=>false];
}
return Http::withBasicAuth($this->client_key, $this->client_key_secret)->withOptions($options);

}

How to fix Curl error 60 without downloading cert

This issue was caused by the change in the certificates of curl. From https://curl.haxx.se/docs/caextract.html

This bundle was generated at Wed Jun 20 03:12:06 2018 GMT .

There is a tool on linux called update-ca-certificates who solves this problem, also, the curl site say's you can run

curl --remote-name --time-cond cacert.pem https://curl.haxx.se/ca/cacert.pem

Just consider any of these commands may be needed to run again in the future if the certificates are renovated again.

cURL error 60: SSL certificate prblm: unable to get local issuer certificate

If you are on Windows using Xampp, I am stealing a better answer from here, would be helpful if Google shows you this question first.

  1. Download and extract for cacert.pem here (a clean file format/data)

    https://curl.haxx.se/docs/caextract.html

  2. Put it in :

    C:\xampp\php\extras\ssl\cacert.pem

  3. Add this line to your php.ini

    curl.cainfo = "C:\xampp\php\extras\ssl\cacert.pem"

  4. restart your webserver/Apache



Related Topics



Leave a reply



Submit