douxi9245 2016-01-29 03:36
浏览 283
已采纳

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 04: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 WSL上下载的joern在windows怎么用?
  • ¥17 MC9S12XS128单片机开发板实验
  • ¥15 jetson nano4GB
  • ¥15 电脑回复出厂设置,重装过程报错提示,求解决方案Windows 无法分析或处理无人参与应答文件 [C:\WINDOWS\Panther\unattend.xml,如何解决?
  • ¥15 进入lighttools中的UDOP编辑器的方法
  • ¥15 求Gen6d训练数据集
  • ¥20 liunx中winscp中可以登入ftp,但是不能登入sftp,如何解决
  • ¥15 lighttools的光学属性自定义的用法流程
  • ¥15 uni-app动态修改推荐页标题时报错
  • ¥15 图片是GET请求,后面是图片的id,Glide如何缓存?
手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部