PHP cURL error code 60

PhpCurl

Php Problem Overview


Whilst trying to setup a php environment on windows (using wamp) to use the Amazon PHP SDK, when i try to run a sample test I get the following error:

Fatal error: Uncaught exception 'cURL_Exception' with message 'cURL resource: Resource id #10; cURL error: SSL certificate problem: unable to get local issuer certificate (cURL error code 60). See http://curl.haxx.se/libcurl/c/libcurl-errors.html for an explanation of error codes.' in C:\wamp\www\AWSSDKforPHP\lib\requestcore\requestcore.class.php on line 848

I have already added the following line to my php.ini

curl.cainfo = C:\Windows\ca-bundle.crt

which is the location of a certificate i created using this VBS script VBS-Script

I have restarted my WAMP service also.

PHP index curl reference

Php Solutions


Solution 1 - Php

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"

Solution 2 - Php

i fixed this by modifying php.ini file at C:\wamp\bin\apache\apache2.4.9\bin\

curl.cainfo = "C:/wamp/bin/php/php5.5.12/cacert.pem"

first i was trying by modifying php.ini file at C:\wamp\bin\php\php5.5.12\ and it didn't work.

hope this helps someone who is searching for the right php.ini to modify

Solution 3 - Php

php --ini

This will tell you exactly which php.ini file is being loaded, so you know which one to modify. I wasted a lot of time changing the wrong php.ini file because I had WAMP and XAMPP installed.

Also, don't forget to restart the WAMP server (or whatever you use) after changing php.ini.

Solution 4 - Php

@Overflowh I tried the above answer also with no luck. I changed php version from 5.3.24 to 5.5.8 as this setting will only work in php 5.3.7 and above. I then found this http://flwebsites.biz/posts/how-fix-curl-error-60-ssl-issue I downloaded the cacert.pem from there and replaced the one I had download/made from curl.hxxx.se linked above and it all started working. I was trying to get paypal sandbox IPN to verify. Happy to say after the .pem swap all is ok using curl.cainfo setting in php.ini which still was not in 5.3.24.

Solution 5 - Php

@Hüseyin BABAL

I am getting error with above certificate but i try this certificate and its working.

https://gist.github.com/VersatilityWerks/5719158/download

Solution 6 - Php

First, we need download this certificate root certificate bundle:

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

Move this file to somewhere such as to PHP folder in Wamp/Xampp folder.

Then edit your "php.ini" :

curl.cainfo ="C:/path/to/your/cacert.pem"

and

openssl.cafile="C:/path/to/your/cacert.pem"

IMPORTANT:

Be sure that you open the "php.ini" file directly by your Window Explorer. (in my case: “C:\DevPrograms\wamp64\bin\php\php5.6.25\php.ini”).

Don't use the shortcut to "php.ini" in the Wamp/Xampp icon's menu in the System Tray. This shortcut didn't work in some cases I faced.

After saving "php.ini" you don't need to "Restart All Services" in Wamp icon or close/re-open CMD.

Try with " var_dump(openssl_get_cert_locations()); " and look at line : ["ini_cafile"]=> string(40) "C:/path/to/your/cacert.pem"

Done.

Solution 7 - Php

Problem fixed, download https://curl.haxx.se/ca/cacert.pem and put it "somewhere", and add this line in php.ini :

curl.cainfo = "C:/somewhere/cacert.pem"

PS: I got this error by trying to install module on drupal with xampp.

Solution 8 - Php

Add the below to php.ini [ use '/' instead of '' in the path] curl.cainfo= "path/cacert.pem"

Restarted my XAMPP. It worked fine for me. Thanks

Solution 9 - Php

if cacert.pem from above links doesn't working try this one worked for me

https://gist.github.com/VersatilityWerks/5719158/download

Solution 10 - Php

The easiest solution to the problem is to add the below command in the field.

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);

Using this will not need to add any certificate or anything.

Solution 11 - Php

First you have to download the certificate from this link

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

and put it in a location you want the name of downloadable file is : cacert.pem So in my case I will put it under C:\wamp64\bin\php\cacert.pem

Then you have to specify the location of the php.ini file

For example, I am using php 7 the php.ini file is located at : C:\wamp64\bin\php\php7.0.10\php.ini

So access to that file and uncommit this line ;openssl.cafile

also update it to be looks like this openssl.cafile="C:\wamp64\bin\php\cacert.pem"

Finally restart your apache server and that's all

Solution 12 - Php

IMPORTANT: after 4 hours , working with laravel 5.7 and php 7.+ and run/use php artison serve on localhost trying to connect to mailgun .

IMPORTANT to Resolve the problem do not work with ip http://127.0.0.1:8000 use localhost or set domain name by host file

ok ,

Solution 13 - Php

The solution is to edit the file php.ini located in your php version(for me it's php7.0.10) not the php.ini of apache. You will find a commented file like this ;curl.cainfo Just change this line like this curl.cainfo = "C:\permCertificate\cacert.pem"

Don't forget to create the "permCertificate" directory and copy the "cacert.pem" file inside it.

Solution 14 - Php

Just so you know what worked for me, The file at https://curl.haxx.se/ca/cacert.... did not work however, the one in the zip folder in the post at (http://flwebsites.biz/posts/how-fix-curl-error-60-ssl-issue) worked for me with no issues at all.

As others have said, copy the certificate file to a location on your hard drive, update the line

;curl.cainfo 

in your php.ini file to read

curl.cainfo= "path_to_cert\cacert.pem"

Restart your Apache server.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionCiaranView Question on Stackoverflow
Solution 1 - PhpHüseyin BABALView Answer on Stackoverflow
Solution 2 - PhpaimmeView Answer on Stackoverflow
Solution 3 - PhpAnazulView Answer on Stackoverflow
Solution 4 - Phppgkerr76View Answer on Stackoverflow
Solution 5 - PhpGaurang GhinaiyaView Answer on Stackoverflow
Solution 6 - PhpQuang Nguyen TriView Answer on Stackoverflow
Solution 7 - PhplittlefoxView Answer on Stackoverflow
Solution 8 - PhpTTS RajaView Answer on Stackoverflow
Solution 9 - PhpKhaled AbuShqearView Answer on Stackoverflow
Solution 10 - PhpArjun LondheyView Answer on Stackoverflow
Solution 11 - PhpMustapha GHLISSIView Answer on Stackoverflow
Solution 12 - Phplior ben yosefView Answer on Stackoverflow
Solution 13 - PhpSami FAREHView Answer on Stackoverflow
Solution 14 - PhpCompilerView Answer on Stackoverflow