Reputation: 3821
I am using socialite in Laravel 5 to setup facebook login. I followed the instructions carefully until I got stuck with the following error
cURL error 60: SSL certificate problem: unable to get local issuer certificate
so I found the this answer to fix it which indeed passed but then I got this error
cURL error 77: error setting certificate verify locations:
CAfile: /Applications/XAMPP/xamppfiles/cacert.pem
CApath: none
Any ideas what's the cause of this error?! and how to fix it?!
Upvotes: 44
Views: 115201
Reputation: 498
ULTIMATE SOLUTION THAT WORKS 2022, 2023, 2024
cacert.pem
' twicecacert.pem
' to 'cacert.crt
'C:/wamp64/bin/php/php7.4.26/extras/ssl/
(your php version may different, so choose that directory.)In your php.ini file from the wamp sever,
Uncomment ;curl.cainfo
& ;openssl.cafile
, be removing the semicolon before it.
Make changes as shown below: curl.cainfo ="C:/wamp64/bin/php/php7.4.26/extras/ssl/cacert.pem"
openssl.cafile="C:/wamp64/bin/php/php7.4.26/extras/ssl/cacert.crt"
Restart wamp
It works like merlin magic
(-_-)
Upvotes: 2
Reputation: 1112
curl.cainfo="C:\xampp\apache\bin\curl-ca-bundle.crt"
That works for me.
Upvotes: 8
Reputation: 721
In your php.ini file, you should also update your
;openssl.cafile
with the same cacert.pem link you used in updating your
;curl.cainfo
Have a look at mine before and after
;curl.cainfo =
;openssl.cafile=
to
curl.cainfo ="C:\php-7.4.11\extras\ssl\cacert.pem"
openssl.cafile="C:\php-7.4.11\extras\ssl\cacert.pem"
this fixes the cURL 60 error
curl.cainfo ="C:\php-7.4.11\extras\ssl\cacert.pem"
while
openssl.cafile="C:\php-7.4.11\extras\ssl\cacert.pem"
fixes the cURL 77 error.
Have fun!
NB: Do not forget to restart your server before trying it out.
For those who wish to find their php.ini file, use this command after you cd into your application
php -i | grep 'Configuration File'
Upvotes: 4
Reputation: 111
This same problem with me in php version 8.0.3 on windows : Solution was I had to uncomment and set openssl.capath=path of certs in php.ini file.
I already set openssl.cafile so it was not throwing error for that but oepnssl.capath was not set sot error was there.
openssl.cafile="C:\Users\Akta\Softwares\php-8.0.3-nts-Win32-vs16-x64\extras\ssl\demoCA\cacert.pem"
openssl.capath="C:\Users\Akta\Softwares\php-8.0.3-nts-Win32-vs16-x64\extras\ssl\demoCA\certs"
Upvotes: 2
Reputation: 99
For solve this error use this code :
$client = new Client(['verify' => false ]);
And use this $client like this in your code:
$headers = [
'Authorization' => 'Bearer ' . $token,
'Accept' => 'application/json',
RequestOptions::BODY => ' any code for your body ',
];
$response = $client->request('POST', 'bar', [
'headers' => $headers
]);
$response = $response->getBody()->getContents();
return $response;
Upvotes: 0
Reputation: 648
I've tried @mahesh-singh-chouhan, @omarsafwany, @LyleK solutions. but get same error repeatedly.
After that, I update php.ini file without double quotes & with .pem extension & I'm succeed to get desired result with below code.
curl.cainfo=E:\Xampp-5.6.3\php\ext\cacert.pem
I've also attached Screenshot.
Please first try above users suggestions, If failed also use this.
Thanks for solutions It creates way for me @mahesh-singh-chouhan, @omarsafwany, @LyleK
Upvotes: 1
Reputation: 4959
i had this problem in windows 2012
i had a virtual dedicated server that host for laravel
then i had this error and
in my php.ini file find this line
[curl]
; A default value for the CURLOPT_CAINFO option. This is required to be an
; absolute path. curl.cainfo = extras/ssl/cacert.pem
i paste my download file into php file sth like this:
curl.cainfo = "C:\Program Files (x86)\PHP\v7.2\extras\ssl\cacert.pem"
in my case i just restart my website
Upvotes: 0
Reputation: 559
I experienced some issues following instructions in regards to error 77.
On Windows 7, depending on your security settings - the file downloaded may be blocked. See screenshot:
Once I unblocked the file and ensured proper user access rights, I also had to put the file in the following location:
C:\xampp\apache\bin\cacert.pem.txt
In addition to changing php.ini per the other posts on this issue.
curl.cainfo="C:\xampp\php\cacert.pem.txt"
After completing the above steps, restarting Apache via the XAMPP Control Panel, the error was resolved.
Upvotes: 10
Reputation: 10586
If it is related to git:
git config --global http.sslverify "false"
will solve the problem.
Upvotes: -5
Reputation: 299
My error is:
cURL error 77: error setting certificate verify locations: CAfile: C:\xampp\apache\bin\curl-ca-bundle.crt CApath: none (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
This works well for me:
Upvotes: 25
Reputation: 21
you did not read the error carefully, now read it carefully
cURL error 77: error setting certificate verify locations: CAfile: D:\XAMPP\apache\bin\curl-ca-bundle.crt CApath: none (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
it means you are missing a file called curl-ca-bundle.crt to verify certificate locations, so you just need to put this(curl-ca-bundle.crt) file into your XAMPP\apache\bin\ folder and everything is fine error 77 has gone.
curl-ca-bundle.crt, to download the file you can use this link https://github.com/nirmalkumar98/nk
Upvotes: 1
Reputation: 1
It seems you forgot to add quote for the file path. I was got the same error (77), that was because i forgot to add quotes. I solved the problem by adding that. ex: "C:\AppServ\php\cacert.pem"
Upvotes: 0
Reputation:
For windows
I had same problem after i updated php on window 2008. Suddenly all my php codes stopped working. What i did, i opned php.ini then i found a line
;curl.cainfo =
and i changed to
curl.cainfo = "C:\Program Files (x86)\PHP\v7.0\cacert.pem"
(remember to remove ; before curl.cainfo)
and everything went to normal. What you need is to download a cert file cert.pem and place it anywhere on your server and change the line as i did in php.ini
Upvotes: 3
Reputation: 3941
If anyone is running Windows with Plesk and they get this error.
You must ensure that the curl.cainfo path is inside the Plesk PHP directory otherwise you will get the error above even with the fix.
curl.cainfo = "C:\Program Files (x86)\Parallels\Plesk\Additional\PleskPHP55\extras\ssl\cacert.pem.txt"
Fixed for me. Hope this helps someone, someday, somewhere.
Upvotes: 1
Reputation: 1
i had the same problem. you have to open the file .pem or pem.txt with a simple editor (bloc-note) and past the (https://curl.haxx.se/ca/cacert.pem) in your file. you have to reload apache.
Upvotes: -1
Reputation: 585
Add cacert.pem file from https://curl.haxx.se/ca/cacert.pem in c:\xampp\php\cacert.pem
Change setting in php.ini file:
curl.cainfo = "C:\xampp\php\cacert.pem
Upvotes: 31
Reputation: 3821
You need to replace the existing certificate with the other one here. After that:
xampp\php\ext
xampp\php\php.ini
curl.cainfo='location from the first step'
to the end of the file.This is the source link.
Upvotes: 2
Reputation: 341
this worked for me
curl.cainfo = "C:\xampp\php\cacert.pem.txt"
hope it helps some one :)
Upvotes: 0
Reputation: 61
Checkout double quote on php.ini file: if you copied and past from the Web maybe you got wrong double quote:
”C:\xampp\php\cacert.pem.txt”
instead of
"C:\xampp\php\cacert.pem.txt"
Upvotes: 6
Reputation: 411
First, you need to download your "curl.cainfo" file then you need to locate it to C:\xampp\php\cacert.pem.txt.
Second, you need to open your php.ini file in Xampp and copy this =>
curl.cainfo = C:\xampp\php\cacert.pem.txt anywhere you want.
Third please restart your Apache Server refresh your localhost page and that should work fine.
Upvotes: 1
Reputation: 1092
I had the same issue and i tried every solution mentioned here and on other posts but none of them worked. I tried
1) Setting proper file rights ( didn't work )
2) Changing file extension ( didn't work)
then i moved the cacert.pem file inside php/ directory in xampp and restarted it, it worked. Hope it helps someone.
Upvotes: 0
Reputation: 89
cacert.pem.txt
in C:\xampp\php
Add to php.ini
:
curl.cainfo = "C:\xampp\php\cacert.pem.txt"
Then it works fine!
Upvotes: 8
Reputation: 11
I read every thread I could find and this one provided the missing piece.
Background: I encountered this issue will trying to get Drupal 8 to check for available updates on a fresh development environment (wamp based).
Example:
[curl]
; A default value for the CURLOPT_CAINFO option. This is required to be an
; absolute path.
curl.cainfo = "C:\wamp\custom\cacert.pem.txt"
If you are using a wamp stack restart it. You should be good to go.
Upvotes: 1
Reputation: 411
I got stuck on this problem as well. It turned out that I had the path to my certificate set incorrectly in my php.ini file. Forgot the .txt extension.
What I had:
curl.cainfo = "C:\xampp\php\cacert.pem"
What I changed it to:
curl.cainfo = "C:\xampp\php\cacert.pem.txt"
Hope this helps.
Upvotes: 40