r/PHPhelp • • May 23 '22

Kreait php realtime database cannot get reference!! (cURL 60 error).

/r/Firebase/comments/uvqaz3/kreait_php_realtime_database_cannot_get_reference/
1 Upvotes

6 comments sorted by

1

u/HolyGonzo May 23 '22

cURL error code 60 refers to being unable to validate the remote certificate. In most cases, remote certificates can be validated as long as you have a good CA bundle.

  1. Go to the cURL official site and download the latest cacert.pem file. It's linked near the top of this page:
    https://curl.se/docs/caextract.html

  2. Save it into your PHP folder (the same folder containing your php.ini file). Technically, you can save it anywhere, but the PHP folder is a pretty good place for it.

  3. Edit your php.ini file and set curl.cainfo to that cacert.pem file (including the full path).

  4. Restart the PHP server.

As long as the remote server is using a valid certificate issued by a well-known CA, the above steps should fix that cURL error. If it's invalid or if it's self-signed or something, that requires different steps.

1

u/Tex_Betts May 23 '22

Oh my gosh, it worked!!!!! Thanks so much!

1

u/Time-Reindeer8137 May 24 '22

In step 3, should I create a curl.cainfo variable and set the value to the path?

In my php.ini file the only place curl is mentioned is in the windows extension section. And I can't find curl.cainfo anywhere in there.

Edit: also I'm a self-taught dev without a CS background, first time tinkering in PHP config. Apologize if it's obvious.

2

u/HolyGonzo May 24 '22

Just add this section:

[curl]
curl.cainfo = <path to the cacert.pem file here>

1

u/Time-Reindeer8137 May 24 '22

I don't think I'm doing it right, can I add this anywhere in the file? I have added it at the very end of the file.

1

u/Time-Reindeer8137 May 24 '22

Figured it out, it was actually a stupid mistake. I didn't set an absolute path. It was till the directory and not till the file itself.