zoukankan      html  css  js  c++  java
  • php中curl不支持https的解决办法

    在php程序中使用curl去访问https站点时,报错:
    Protocol https not supported or disabled in libcurl 

    该错误信息表示php当时编译时使用的curl库不支持https, 验证方法为
    你的curl安装目录/bin/curl  -V  
    显示如下:
    Protocols: dict file ftp gopher http imap pop3 rtsp smtp telnet tftp
    这表示curl是不支持 https的

    为了支持https,需要下载源码包,重新编译curl

    tar zxvf curl-7.24.0.tar.gz
    cd  curl-7.24.0
    ./configure --prefix=/usr/local/services/curl-7.24.0 --with-ssl=/usr/local/services/openssl-0.9.8a
    #请注意,这里一定要使用 --with-ssl 参数,前提是你已经安装了openssl-0.9.8a (建议安装0.9.8a 测试过0.9.7i有些bug)
    该步骤执行结束后,一定要观察仔细,是否有这行
      SSL support:     enabled (OpenSSL)
    如果你的是
      SSL support:     no 
    那就是说,你的curl依旧没有支持https

    make  &&  make install 
    在make的时候,也许你会遇到这样的错误:
    `a local symbol' can not be used when making a shared object; recompile with -fPIC
    libssl.a: could not read symbols: Bad value
    解决办法,请参考http://mylinux.5d6d.net/viewthread.php?tid=1013
    安装完成后,再次运行
    curl安装目录/bin/curl -V
    结果为
    Protocols: dict file ftp gopher http https imap pop3 rtsp smtp telnet tftp
    这说明已经支持了https 

    剩下的就是重新编译php, 当然相应的支持curl的参数为  --with-curl=你的curl安装目录

  • 相关阅读:
    程序猿编程,软件设计都干什么?
    工作流——来龙去脉
    开发编码流程
    我的spring-boot开发环境
    JSR 303
    项目中java异常处理
    学习交流,一些数据结构和算法实现!
    C运算符
    js锚点
    玻璃工艺学笔记
  • 原文地址:https://www.cnblogs.com/AloneSword/p/3832637.html
Copyright © 2011-2022 走看看