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安装目录
最新文章
- crm2011 使用SOAP 查询单个记录 Retrieve
- (七)HTTP协议
- .htaccess根据IP地址限制访问
- iOS-----类和对象,nil/Nil/NULL的区别
- SAP 禁止某个库位的货物移动
- javascript中的this应用
- C#DataGridView 美化
- linux kernel 模块多文件编译
- SharePoint移动客户端--Rshare 中的Smart Cache
- 网络断开后重连downloadProvider继续下载问题调试分析
- css案例学习之继承关系
- spring Bean类自动装载实现
- PHP 【三】
- AVAudioSesion和AVAudioPlayer的基本使用
- 既然写CSS很容易,那为什么大家还是把CSS写的那么烂呢?
- SAS对数据变量的处理
- CF115B Lawnmower(贪心)
- flask + apidoc 生成接口文档(附加一个坑)
- OpenCV中图像算术操作与逻辑操作
- (转)st(state-threads) coroutine和stack分析