Unable to enable crypto on TCP connection api.mysite.com on Zend

user2740957 picture user2740957 · Jun 19, 2014 · Viewed 7.9k times · Source

I was creating a module application for Zend Framework 2. When I try to send a post request to my server with the necessary details, I get the error "Unable to enable crypto on TCP connection api.mysite.com". Earlier, I was getting the error "Unable to enable crypto on TCP connection api.mysite.com: make sure the "sslcafile" or "sslcapath" option are properly set for the environment."

On googling, I found I should set sslverifypeer to false. After doing this, I was left with the 1st part of the sentence "Unable to enable crypto on TCP connection api.mysite.com." Not getting idea where I could be wrong.

Under previous exceptions, I get "stream_socket_enable_crypto(): this stream does not support SSL/crypto"

Answer

Tim Fountain picture Tim Fountain · Jun 19, 2014

Please see this note in the docs: http://framework.zend.com/manual/2.3/en/modules/zend.http.client.html#connecting-to-ssl-urls . You shouldn't set sslverifypeer unless the site you're connecting to doesn't have a valid SSL certificate. Instead, set sslcapath as the error suggests. This gives PHP a way of validating the SSL certificate supplied by the host you're connecting to.