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

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 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘