Twilio PHP API Librarie: Warning: file_get_contents(): SSL operation failed with code 1

让人想犯罪 __ 提交于 2019-12-07 12:24:20

问题


I installed Official Twilio PHP API Librarie via composer ( "twilio/sdk": "~3.12" ).

When I trying use API ( for example send an SMS ) using Test Credentials I get the error:

Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed in ..vendor/twilio/sdk/Services/Twilio/HttpStream.php line 62

If I trying send SMS in terminal using curl - everything is OK.

How it may be fixed without editing Twilio PHP API Librarie code?


回答1:


Twilio developer evangelist here.

I found this happened when you don't have the curl bindings for PHP. Try recompiling PHP with curl or installing the php5-curl package.

Let me know if that helps at all.




回答2:


Here's how I fixed the problem. Edit Twilio.php, right above verify_peer, add this line:

'cafile' => '/etc/ssl/certs/ca-certificates.crt',

This fix worked for me on Ubuntu 14.04 running PHP 5.5.9.



来源:https://stackoverflow.com/questions/27313186/twilio-php-api-librarie-warning-file-get-contents-ssl-operation-failed-with

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!