douxi9245 2016-01-29 11:36
浏览 284
已采纳

cURL错误:无法连接:已禁用SSL。 错误号码35

I am working on the paypal ipn script in one of my applications hosted on a Digital Ocean's box with Centos 7.

When i try to connect to the paypal sandbox api i get the error "Cannot connect: SSL is disabled."

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

this is what my cURL script looks like

// STEP 2: Post IPN data back to paypal to validate

$ch = curl_init('https://www.sandbox.paypal.com/cgi-bin/webscr'); // change to [...]sandbox.paypal[...] when using sandbox to 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 much experience with Linux server setup so I am learning as i go along. Any help or guide is much appreciated

UPDATE : when i run the this command in the command line curl --version https://sandbox.paypal.com/cgi-bin/webscr

i get this error curl: (1) Protocol "https" not supported or disabled in libcurl

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

So i am guessing the new question would be how to enable https in libcurl?

  • 写回答

4条回答 默认 最新

  • douhuai2861 2016-01-30 12:08
    关注

    I was able to solve this problem with the help of one my friends with a lot of Linux experience. Apparently this was an issue with the version of cURL installed on my Digital Ocean box.

    So the solution was to remove the version of cURL i had installed which was not installed correctly because i had built the binaries my self.

    I installed the problematic cURL using these commands

    wget -O curl.tar.gz http://curl.haxx.se/download/curl-7.42.0.tar.gz
    tar -xvzf curl.tar.gz
    cd curl-7.42.0
     ./configure 
    make
    make install
    

    I removed the problematic cURL that had https issues like this

    which curl
    

    (To tell me where the executable was located and it was located in usr/local/bin/curl)

    Then i did

    sudo rm -f /usr/local/bin/curl
    

    (To remove the cURL giving issues)

    Then i used the command

    sudo yum install curl php5-curl
    

    This installed cURL correctly for me. The i ran

     curl --version
    

    To confirm that https is now supported in the cURL version and it was.

    I logged out of my droplet and logged back in. Then tried the

    curl --version "https://sandbox.paypal.com/cgi-bin/webscr" 
    

    command and everything worked. I was able to connect to Paypal.

    Thanks to everyone for their help and comments.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 宇视监控服务器无法登录
  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥50 power BI 从Mysql服务器导入数据,但连接进去后显示表无数据
  • ¥15 (关键词-阻抗匹配,HFSS,RFID标签天线)