Monday, April 04, 2016

SSL certificate problem on Azure running PHP

So recently I was trying out a piece of code in PHP, and wanted to hit the Google reCaptcha server, but my curl requests all failed for some reason.

I then added an 'echo curl_error($curl);' to my code and was greeted with a "SSL certificate problem: unable to get local issuer certificate" error. Now this was much more meaningful, than a blindly failing curl request.

So here is how I fixed this issue:

Physical file configuration:

  1. Open your Azure file structure, perhaps using your favorite FTP client. I swear by FileZilla!
  2. In your site folder structure, create a folder say, "ini" under the "site" folder.
  3. Create another folder under the 'site' folder named 'ca'
  4. Go to and download the 'cacert.pem' file. Place this file inside the 'ca' folder
  5. Inside 'ini' folder create a text file 'extensions.ini'
  6. Add the following line to the 'extensions.ini' file - "curl.cainfo=d:\home\site\ca\cacert.pem"
Azure Portal configuration:
  1. Head to your account
  2. Refer to the documentation on how to configure custom PHP settings.
  3. Open the 'Application Settings' page for your offending Web App.
  4. On this page, under 'App Settings', set 'PHP_INI_SCAN_DIR' to 'd:\home\site\ini'
  5. Remember to hit 'Save' on top of this page, and then restart this Web App.

Wait for a few seconds, and try opening your web page again. My error vanished at this pointed and I was back in business!

Hope this helps someone out there reading this page.


Unknown said...

God bless you!
I have no words to describe how thankful I am, would you accept donation?

kevenman said...

Thank you for imparting more of your ideas. Good job! Many thanks your website is surprisingly valuable for me. I really had a great time with your post! best golf gps watch

jhansi joe said...

Hello Admin, thank you for enlightening us with your knowledge sharing. PHP has become an inevitable part of web development, and with proper PHP Training in Chennai, one can have a strong career in the web development field. We from Fita provide PHP course in Chennai with the best facilitation. Any aspiring students can join us for the best PHP Training Institute in Chennai

Sanjana E said...

Glad to see your explanation. thanks for the update
Php Training institute in velachery

Ruben Marquardt said...

Hi thanks for the help, Iam getting this error:

RequestException in CurlFactory.php line 187:
cURL error 77: error setting certificate verify locations:
CAfile: d:\home\site\ca\cacert.pem

Could you help me? seems that they don't like to read de ca folder???

Amirtha rao said...

Im no expert, but I believe you just made an excellent You certainly understand what youre speaking about, and I can truly get behind that.
cloud computing training in chennai|Salesforce Training in Chennai

Tina Kenard said...

In coming years, cloud computing is going to rule the world. The cloud based CRM tool provider like Salesforce have massive demand in the market. Thus talking Cloud Computing Training in Chennai from reputed Cloud Computing Courses will ensure bright career prospects for aspiring professionals.

sai pallavi said...

Awesome Post here. This is really great and informative post.This is useful for best Php Jobs In Hyderabad

Rasool Bevi said...

The expansion of internet and intelligence in the business process lead the way to huge volume of data. It is important to maintain and process these data to be efficient in data handling. Hadoop Training in Chennai | Big Data Training in Chennai

Amirtha rao said...

Hi, JAVA is not at all difficult all you need is to clear your concepts mainly because the concepts of JAVA programming have been taken from day to day life examples.J2EE Training in Chennai | JAVA Training in Chennai

Rasool Bevi said...

Thanks for sharing use interview questions on.Net technology. While preparing for my job interview, your article helped me a lot to sharpen my skills and do well in my interview. One of trainer from leading dot net training in Chennai suggests me about your site.

Rasool Bevi said...

I went through your blog and it’s totally awesome. Keep on updating your site with such informative post. If possible please include rss feed for your blog. Web design training in Chennai | Web designing course in Chennai | Best web designing course in Chennai

Mathew Stephen said...

These all are notable facts… I stick with responsive website design for my business. With the mobile marketing is at its peak stage, having website that goes comfy on all devices will help your business. You can check my website for more details on the importance of responsive website design. PHP Training in Chennai | Best PHP training in Chennai | PHP Training Institute in Chennai

Amirtha rao said...

Hi Admin, I went through your article and it’s totally awesome. You can consider including RSS feed for easy content sharing, So that you can drive huge traffic to your blog. Hadoop Training in Chennai | Big Data Training in Chennai

Bay Max said...

Thanks for sharing your informative article. As every business owner desire to be the part of digital marketing, there is massive demand for attractive and responsive website. It automatically increases the career prospects of web design and development professionals. Taking Web designing course in Chennai will help students to enter web design industry with good salary package.

Rasool Bevi said...

Great and impressive article!! Got to learn and know more about web development. To know more refer create website for much more unique ideas.PHP Training in Chennai | Best PHP training in Chennai

Logavani G said...

really you have posted an informative blog. it will be really helpful to many peoples. thank you for sharing this blog.
java training in chennai

preethi said...

good information.helpful to know about web designing.
Web Designing Training in Chennai

kim john said...

I am really impressed the way you have written the blog. Hope we are eagerly waiting for such post from your side. HATS OFF for the valuable information shared!
PHP Training in Chennai
PHP Training Chennai
PHP Course in Chennai