HTTP_Reques2 socket adapter and ssl
| From: | David Jean Louis | Date: | Mon, 14 Sep 2009 13:13:54 +0000 |
| Subject: | HTTP_Reques2 socket adapter and ssl | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-52818@lists.php.net to get a copy of this message | ||
Hi Alexey,
I was trying to implement ssl support in Services_Twitter (we use HTTP_Request2 with the socket adapter by default) and it wasn't working, the error I had was:
"""
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed in /usr/share/php/HTTP/Request2/Adapter/Socket.php on line 290
Call Stack:
[snip]
0.0787 1100700 8. stream_socket_client() /usr/share/php/HTTP/Request2/Adapter/Socket.php:290Warning: stream_socket_client(): Failed to enable crypto in /usr/share/php/HTTP/Request2/Adapter/Socket.php on line 290 Call Stack: [snip]
0.0787 1100700 8. stream_socket_client() /usr/share/php/HTTP/Request2/Adapter/Socket.php:290Warning: stream_socket_client(): unable to connect to ssl://twitter.com:443 (Unknown error) in /usr/share/php/HTTP/Request2/Adapter/Socket.php on line 290 Call Stack: [snip]
0.0787 1100700 8. stream_socket_client() /usr/share/php/HTTP/Request2/Adapter/Socket.php:290Unable to connect to ssl://twitter.com:443. Error #0: (code: 0, call: https://twitter.com/statuses/update.json) """ I realized that it was because HTTP_Request2 sets ssl_verify_peer option to true by default; setting it to false in my code solved the problem. Is this deliberate or is it a bug ? because in the php documentation default is false: http://php.net/manual/en/context.ssl.php Thanks, -- David