Export HTTPS certificate in a format acceptable for PHP SSL context option "cafile"
stackoverflow only provides the server cert, and the intermediate ca cert. not the root ca cert.
openssl cafile only works if the full chain (to a self signed root ca) can by verified,
so you either have to trust the ROOT CA your self by downloading it, or use some kind of pki so you have all the global trusted root CAs.
on Debian GNU / Linux based machines you can install the ca-certificates package,
sudo apt-get install ca-certificates
or you can use the cacert from mozilla https://curl.haxx.se/docs/caextract.html