Fixing Twilio’s SSL Certificate Errors in PHP and Ubuntu

If you’re trying to get the latest version of the Twilio API up and running on PHP with Ubuntu 14.04, and you keep getting errors about SSL, you’re most likely missing the php5-curl package.

The error would look like the following:

Fatal error: Uncaught exception 'Services_Twilio_TinyHttpException'
with message 'SSL certificate problem, verify that the CA cert is OK.
 
Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate
verify failed' in [MY PATH]\Services\Twilio\TinyHttp.php:89

You can fix it immediately with the following command:

$ sudo apt-get install php5-curl

If you’ve already tried everyone else’s workaround about using /etc/ssl/certs, or any other sort of curl certificate directory structure in your .curlrc, and you’ve got an error relating to the following:

PHP Fatal error:  Uncaught exception 'Services_Twilio_TinyHttpException' with message 'error setting certificate verify locations:
  CAfile: /etc/ssl/certs/
  CApath: /etc/ssl/certs' in /usr/share/nginx/twilio/Services/Twilio/TinyHttp.php:119
Stack trace:
#0 ....

Then make sure and comment back out your php.ini file. You don’t need the certificate directory to be pointed to once you’ve installed php5-curl.

Leave a Reply

Your email address will not be published. Required fields are marked *