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

Published 3 years ago by slim12kg

I just installed mandrill and tried sending a message using the Maill::Send function but i get the error ": cURL error 60: SSL certificate problem: unable to get local issuer certificate". I actually thought it was a problem with curl not on my windows, so i installed curl and a certificated, yet it persist. Any idea what might be the problem?

nolros
nolros
3 years ago (82,750 XP)

Assuming there are no issues with your code, it could be your firewall. Try disabling your firewall to test.

bashy
bashy
3 years ago (996,700 XP)

You can ignore that warning and give cURL the -k or --insecure param to omit that message.

It's just because it's trying to connect to HTTPS and doesn't have the cert to verify it.

slim12kg

@bashy Please how do i this.Am using a windows OS

bashy
bashy
3 years ago (996,700 XP)

Could be due to firewall as nolros said, have you tried that?

Guess you can't add those params on Mail class stuff.

wolfiezero

I'm getting this using Guzzle POSTing to a HTTPS address from my local Homestead VM.

Am I right in thinking I need to make a certificate type file? I've only looked into this issue in the last hour so very rusty!

bashy
bashy
3 years ago (996,700 XP)

Just had a thought, I add Google for my DNS so it could be the default local blocking you from doing it.

sudo nano /etc/resolvconf/resolv.conf.d/base

Add in this

# Google
nameserver 8.8.8.8
nameserver 8.8.4.4

Then to update the /etc/resolv.conf file, run this

sudo resolvconf -u
null05

Solution:

Make sure that you have "guzzlehttp/guzzle": "~4.0". It has to be THIS particular version. Can't be higher.

I installed mine using composer require guzzlehttp/guzzle and it installed version 5.2. Which cause it not to send emails. Correcting composer.json and running "composer update" fixed it straight away.

Sven0188

I had the exact same but on Windows & xampp. My solution was as simple as: Follow this link: http://curl.haxx.se/ca/cacert.pem Copy the entire page and save it in a: "cacert.pem"

Then in your php.ini file insert or edit the following line: curl.cainfo = "[pathtothisfile]\cacert.pem"

Problem solved

bashy
bashy
3 years ago (996,700 XP)

It's related to cURL not being able to get the above file. Providing it solves it but it's better to fix the main problem.

moez

@Sven0188

Dear,

First thanks, I try to do it with putting the line curl.cainfo = "[pathtothisfile]\cacert.pem" in a helper file and load this helper in a composer, but i want to know what is the pathtothisfile ? and where can i put the "cacert.pem" file exactly

Thanks

sitesense

I don't know how you are using Guzzle or how it's called within your program but you could try the options below if you can access the Guzzle instance:

// disable cert verification
$guzzle->setDefaultOption('verify', false);

// use a cert
$guzzle->setDefaultOption('verify', '/path/to/cacert.pem');

Where to store the cert? Well it doesn't really matter - maybe /resources/assets/?

Sven0188

@Moez

This is where I have put the pem file exactly: D:\xampp\php\extras\ssl

In other words under your PHP\extras\ssl folder. I am using XAMP as PHP stack.

Hope it helps

GeoffGordon

I just spent a number of hours grappling with this. The correct answer is indeed to put the cacert.pem file and amend the php.ini file to match as suggested by Moez above. ..... but I kept on getting CURL error 60's The trick was getting a clean copy of the PEM file! Any method involving windows notepad or other editors corrupts the file and gives the cURL error 60 etc. Finally I found https://gist.github.com/VersatilityWerks/5719158/download and downloaded a tar file with a clean copy of the cacert.pem file ...... it then all worked perfectly.

Hope this saves others time.

SachinAgarwal

@GeoffGordon That is just a workaround I say. Because there is no such error with Guzzle 4. When we use Guzzle 4 it do not throw such error but for Guzzle 5 it throws.

bashy
bashy
3 years ago (996,700 XP)

It's probably how Guzzle 4/5 handle the command used with cURL. I haven't looked at the code but maybe it ignores SSL certs...

Please sign in or create an account to participate in this conversation.