
Your command or PHP script fails with curl: (35) SSL connect error — often with “handshake failure” or “wrong version number” appended. This cURL error 35 fix guide explains what went wrong: the TCP connection succeeded, but the TLS handshake — the encrypted negotiation that follows — collapsed. That places error 35 squarely between error 7 (no connection at all) and error 60 (connection made, certificate rejected), and each stage needs different fixes. Updated for 2026.
Think of it as getting through on the phone but failing to agree on a language. Your machine and the server connected fine, then could not agree on a TLS version, cipher suite, or certificate chain to speak securely. The usual culprits: outdated curl/OpenSSL that only speak old TLS, code forcing obsolete protocol versions, a wrong proxy setting, or a server answering HTTPS with plain HTTP.
What Causes cURL Error 35
- Outdated curl/OpenSSL: old builds that cannot negotiate TLS 1.2/1.3 — fixes roughly 70% of cases when updated.
- Forced obsolete TLS version: code setting
CURLOPT_SSLVERSIONto TLS 1.0/1.1, which modern servers reject. - Cipher suite mismatch: no shared cipher between client and server.
- Wrong https_proxy value:
https_proxy=https://proxy:3128when the proxy only speaks plain HTTP — handshake dies before the server is even contacted. - Server not doing TLS: plain HTTP answering on port 443 (“wrong version number” variant).
- Broken certificate chain: missing intermediates failing verification mid-handshake.
- Wrong system time: clock skew invalidating the handshake.
How to Fix cURL Error 35: 7 Steps
Step 1: Update curl and OpenSSL
On Debian/Ubuntu: sudo apt update && sudo apt upgrade curl openssl. On macOS: brew upgrade curl openssl. On Windows: download the latest curl binary from curl.se. For PHP, updating PHP itself refreshes its bundled curl/OpenSSL — then restart Apache/PHP-FPM. Verify with curl --version and openssl version, then retest.
Step 2: Debug the handshake verbosely
Run curl -v https://example.com 2>&1 | head -n 30 and read where it stops: “TLS handshake” lines reveal the exact failure point. Compare with openssl s_client -connect example.com:443 -servername example.com — if OpenSSL shows “wrong version number” and no certificate, the server is not doing TLS on that port at all (a server-side fix).
Step 3: Stop forcing old TLS versions
Search your code for CURLOPT_SSLVERSION forcing TLS 1.0/1.1 and remove it — let curl negotiate automatically. If you must pin a version, use CURL_SSLVERSION_TLSv1_2 (which allows 1.2 and 1.3), never older. On the command line, test explicitly with curl --tlsv1.2 https://example.com and curl --tlsv1.3 https://example.com to find which the server accepts.

Step 4: Fix the proxy setting
Run env | grep -i proxy. If https_proxy uses an https:// scheme but the proxy only speaks HTTP, the handshake fails before reaching the server. Fix it with export https_proxy=http://proxy.local:3128 (plain http:// still tunnels HTTPS via CONNECT). Confirm with curl -v --noproxy '*' https://example.com — if that works, the proxy was the problem.
Step 5: Check the CA bundle and system time
Ensure a valid CA bundle is configured (see our cURL error 60 guide for the exact paths). Then verify the system clock — certificate validation depends on correct time, so enable automatic time sync on the machine running curl.
Step 6: Verify the server’s TLS setup
Test with openssl s_client -connect example.com:443 -tls1_2 -servername example.com. If the handshake fails here too, the server needs attention: enable TLS 1.2+, install the full certificate chain (leaf + intermediates), and ensure the port serves TLS not plain HTTP. For the plain-HTTP-on-443 variant, see our SSL record too long guide.
Step 7: Confirm the lasting fix
Re-run the original command without version overrides and confirm a clean handshake in verbose output (“SSL connection using TLSv1.3 … CERTIFICATE_VERIFY_OK”). Remove any temporary -k flags and document the required minimum TLS version for the endpoint. For connection-level failures instead, see our cURL error 7 guide.
How to Prevent cURL Error 35
Keep curl, OpenSSL, and PHP on supported versions through automated updates — most error-35 incidents trace to stacks years out of date. Never hard-code TLS versions or cipher lists in application code; let the library negotiate, and treat any CURLOPT_SSLVERSION in your codebase as tech debt. In deployment pipelines, add a handshake smoke test (curl --tlsv1.3 against critical endpoints) so protocol breakages fail the build, not production. A periodic TLS check with a free SSL diagnostic tool catches server-side drift early.
Conclusion
cURL error 35 is a failed TLS negotiation: update curl/OpenSSL, stop forcing obsolete TLS versions, fix the proxy scheme, and verify the server actually speaks TLS. Diagnose with curl -v before changing anything — the verbose output names the culprit. For more command-line errors explained plainly, follow the KamiWeb blog.
