I am using Firebase php SDK link and working with laravel latest version on XAMMP server on windows 10 but when i try to use Firebase APi using above php SDK i get this error.i download .pem certificate manually but still not working
Error
Kreait \ Firebase \ Exception \ ApiException
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)
Previous exceptions
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) (0)
In your case, simply do this
Open your php.ini file and update this
;openssl.cafile=
with
openssl.cafile="C:\xampp\apache\bin\curl-ca-bundle.crt"
For others who might face this error, follow this:
It has to do with your cURL certification. Take these steps:
Head over to http://curl.haxx.se/ca/cacert.pem
. This link gets you (downloads) the latest cacert.pem file.
Use this command on your terminal on the application you are currently working on so that you would know the exact PHP used in cases of multiple installations of PHP on your computer, php -i | grep 'Configuration File'
. This shows you the exact location of the php.ini file for the current application you are running. For instance, mine is C:\php-7.4.11\php.ini
. Note this location as we will use it soon.
Go into this location C:\php-7.4.11
ie. the folder containing the php.ini file in my case, open "extras", open "ssl" (for clarity sake, mine looks like this C:\php-7.4.11\extras\ssl
). In this folder, paste in the newly downloaded cacert.pem file from Step 1 above.
Right-click on the cacert.pem file and unblock it from "Properties" as it could complain of coming from another computer. Still on this Properties section pop-up, copy the new file location link from the "Security" section (mine is C:\php-7.4.11\extras\ssl\cacert.pem
ensure to copy yours). You can also copy this from the file browser header.
Go to this location C:\php-7.4.11\php.ini
(this is my php.ini location. Go to yours) and update the following 2 fields on your php.ini file.
;curl.cainfo =
;openssl.cafile=
with
curl.cainfo ="C:\php-7.4.11\extras\ssl\cacert.pem"
openssl.cafile="C:\php-7.4.11\extras\ssl\cacert.pem"
NB: You get cURL 60 error if curl.cainfo
is not updated. And cURL 77 if openssl.cafile
is not updated.
Also, do not forget to uncomment the ;
before curl.cainfo
and openssl.cafil
e.
Hope this helps someone.
In my case using MAMP PRO I had this error :
CURL error: error setting certificate verify locations:
CAfile: /Applications/MAMP/Library/OpenSSL/cert.pem
CApath: none
The file /Applications/MAMP/Library/OpenSSL/cert.pem was a symlink to /Applications/MAMP/Library/OpenSSL/certs/cacert.pem
it appeared that the file was here but seems to be corrupted or out of date.
I downloaded the new one from here and replaced it. Then it worked again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With