error setting certificate verify locations: CAfile while using tmhOAuth


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

What the?

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  > /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






  1. Wow, thank you so much. That solved my problem with tmhOAuth. Second time in a week your site has helped my with coding problems! 🙂

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.