php - cURL Error : Cannot connect: SSL is disabled. Error number 35 -


i working on paypal ipn script in 1 of applications hosted on digital ocean's box centos 7.

when try connect paypal sandbox api error "cannot connect: ssl disabled."

i have tried several things adding path of curl.cainfo in php.ini file so
curl.cainfo = /etc/pki/tls/certs/ca-bundle.trust.crt

this curl script looks like

// step 2: post ipn data paypal validate  $ch = curl_init('https://www.sandbox.paypal.com/cgi-bin/webscr'); // change [...]sandbox.paypal[...] when using sandbox test curl_setopt($ch, curlopt_sslversion, 4); curl_setopt($ch, curlopt_ssl_cipher_list, 'ecdhe_rsa_aes_128_gcm_sha_256');  curl_setopt($ch, curlopt_http_version, curl_http_version_1_1); curl_setopt($ch, curlopt_post, 1); curl_setopt($ch, curlopt_returntransfer,1); curl_setopt($ch, curlopt_postfields, $req); curl_setopt($ch, curlopt_timeout, 30); curl_setopt($ch, curlopt_forbid_reuse, 1); curl_setopt($ch, curlopt_httpheader, array('connection: close')); curl_setopt($ch, curlopt_ssl_verifyhost, 0); curl_setopt($ch, curlopt_ssl_verifypeer, 0); 

i have not got experience linux server setup learning go along. or guide appreciated

update : when run command in command line curl --version https://sandbox.paypal.com/cgi-bin/webscr

i error curl: (1) protocol "https" not supported or disabled in libcurl

also command curl --version displays curl 7.42.1 (x86_64-unknown-linux-gnu) libcurl/7.46.0

so guessing new question how enable https in libcurl?

you're setting wrong ssl version:

curl_setopt($ch, curlopt_sslversion, 4);

the paypal sandbox supports tls 1.2 (which curlopt_sslversion == 6). correct ssl version used automatically if use php 5.5.19+ , openssl 1.0.1+, or can force following (still requires openssl 1.0.1+):

curl_setopt($ch, curlopt_sslversion, 6);


Comments