After going crazy for about two hours to solve this simple error: “Peer certificate cannot be authenticated with known CA certificates using PHP OAuth extension” I searched for many queries like “unable to get local issuer certificate” or “cacert.pem” and finally figured it out.
If you search online you will run into a lot of cacert.pem solutions but its actually not the right one.
Lets get right into it:
1) Download the certificate file like
2) Copy the downloaded file and paste to the following directory and make sure the read/write permission are setup correctly.
(replace the first folders with your own app.) For example Im using AMPPS so my file directory is different than MAMP or XMPP. Very imporant to get the correct path here.
3)Add the following line to your php.ini (make sure its the correct version and dont just drop it the the first one you see there)
4) Restart the Apache Server and you are good to go.
If you cant get this going then go back and see what you did wrong because it works