While I was working with twitter API and using one of the known PHP Twitter API wrapper called tmhOAuth, written by Matt Harris I fumble upon this error.
error setting certificate verify locations: CAfile
I did some reading and then I realized that my cacert.pem was not copied to the desired folder.
So I copied the downloaded file from the Repo and re-ran my twitter API tests.
Again same error happened. Now I was pulling my hair apart at this time. Then I realized that it could be possible that my .pem is outdated.
Thus I downloaded my cacert.pem file from here
You can either use CURL itself to download our certificate like this
curl http://curl.haxx.se/ca/cacert.pem > /myloc/cacert.pem
Or you can also right click on the above link and save it somewhere. You have to keep up with this the latest .pem file for just in case situations.
I hope that this helps.
I was able to resolve my errors by updating my cacert.pem file