Upon activating the WordPress plugin and following the Disqus documentation, the configuration wizard would fail with the error “Unable to connect to the Disqus API servers”.
Inside the function wp-content\plugins\disqus-comment-system\lib\api\disqus\url.php on line 55 there is a CURL call to fetch information from Disqus, which was failing on certificate/https validation.
I was able to workaround the issue by undertaking these steps –
- Download the cacert.pem file manually from https://curl.haxx.se/docs/caextract.html and place it in the lib\api\disqus\ folder
(Tip – you can use Kudu with Azure Apps to easily upload the file – http://www.jamessturtevant.com/posts/How-to-add-edit-and-remove-files-in-your-azure-webapp-using-the-kudu-service-dashboard/)
- Around Line 55 in the api\disqus\url.php file add the following to the $c_options array
CURLOPT_SSL_VERIFYPEER => true,
CURLOPT_CAINFO => __DIR__ .’/cacert.pem’
(You can edit using Kudu, but I edited this file using the new App Service Editor feature from the Azure portal as I wanted to try it out. The App Service Editor is a web based IDE based on the Monaco code editor which ships with Visual Studio Code)
Don’t forget the comma at the end of the existing CURLOPT_TIMEOUT => SOCKET_TIMEOUT – I’m not a dev guy so this caught me out initially!
Hopefully if you are suffering the “Unable to connect to the Disqus API servers” error this will help. I’m not sure if this is specific to Azure Web Apps or other web hosts too.