5

I am tryng to send SMS using Textmagic from godaddy using php. I have used the official git-hub page to get API https://github.com/textmagic/textmagic-rest-php

The above setups works fine from my local Ubuntu PC and able to send SMS, Where as when I host the API to Godaddy Windows shared hosting, and executed the same php code, I got following error.

[ERROR- ] error setting certificate verify locations: CAfile: c:\cgi\php56\curl-ca-bundle.crt CApath: none

What could be the reason.

Php version:5.6

CodeDezk
  • 1,230
  • 1
  • 12
  • 40
  • https://superuser.com/questions/442793/why-cant-curl-properly-verify-a-certificate-on-windows or https://talk.plesk.com/threads/curl-error-77-error-setting-certificate-verify-locations-windows.342389/ might help? or maybe https://stackoverflow.com/questions/34087962/ssl-tls-operations-failing-php5-6-curl-ca-bundle-crt-cacert-pem Does that file exist? Does it have permissions to read it? Is it up to date? – Leentje Dec 17 '18 at 17:01
  • Would be interesting to see if it works when you set `curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);` – Leentje Dec 17 '18 at 17:06
  • Disabling the certificate checks is probably not the best idea. – t1gor Dec 19 '18 at 09:48

2 Answers2

0

I'm not sure if there is something GoDaddy configures that would not make this possible, but the best/most secure way to tackle this is to NOT use CURLOPT_SSL_VERIFYPEER = FALSE, but instead export the certificate chain to X.509. Then use CURLOPT_CAINFO to point to that certificate.

IE

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_CAINFO, "/path/to/the/certificate-you-exported.crt"); 

If GoDaddy does not let you do this, my suggestion would be to find another provider.

conrad10781
  • 2,223
  • 19
  • 17
-1

you can use :

 curl_setopt($link, CURLOPT_SSL_VERIFYPEER, FALSE);

but please be sure : you will lose the benefit of certification verification.

bypassing verification is not a good idea , ( may any one with you on the server get the URL and your api key )

if you have a root access on the server please enable permission for the user on the server verification folder :

chmod 755 /usr/share/ssl/certs 

this link can help for goddady : https://blog.hqcodeshop.fi/archives/304-Fixing-curl-with-Go-Daddy-Secure-Certificate-Authority-G2-CA-root.html

MoxGeek
  • 458
  • 6
  • 17