comment 1

cURL error 35 – Unknown SSL protocol error in connection

This problem bugs me for a couple of minutes. I was trying to use curl on sending POST request to a specific website with SSL but it returns cURL error 35. So I tried to ask my friend google for a solution. A couple of stackoverflow links appeared and most of them told me to try adding this to my PHP code.

curl_setopt($ch, CURLOPT_SSLVERSION,3);

But that didn’t solve my problem. So I dig in deeper. I tried cURL on terminal.

curl -v

And it returns this:

* About to connect() to port 443 (#0)
*   Trying connected
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
* Unknown SSL protocol error in connection to 
* Closing connection #0
curl: (35) Unknown SSL protocol error in connection to

So I tried installing ca-certificates. By the way I’m using CentOS 6.5

yum install ca-certificates

Still didn’t solve my problem. So I have no other option but to try upgrading my curl by issuing this commands

rpm -Uvh
yum clean all
yum install libcurl

and then restart my apache.

service httpd restart

and suddenly it worked! 😀

So if you ever encounter this type of error and adding curl_setopt($ch, CURLOPT_SSLVERSION,3); didn’t solve your problem, try upgrading your curl 😀

By the way, remove curl_setopt($ch, CURLOPT_SSLVERSION,3); if you have upgraded your curl already before testing again. 😀


The latest libcurl requires libnghttp2. So if in case you encounter a dependency error while installing libcurl, follow this instruction to install libnghttp2.

First install epel repo

cd /tmp
rpm -ivh epel-release-6-8.noarch.rpm

Then install libnghttp2.

yum install nghttp2

Then after it’s done, you should be able to install the latest libcurl with no problem.

1 Comment so far

Leave a Reply

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