在centos 6.2的系统里面的curl支持的https是nss版本的,而不是openssl的,所以在php使用curl访问https的时候会报Unable to load client key -8178的错误,在google group里面找到了灵感,也是curl和https的,里面说倒是curl的问题:
https://groups.google.com/forum/?fromgroups=#!topic/pongba/sgMYM9dGI7k

根据链接里面说的,去官网下载了一个最新版本(curl-7.28.1.tar.gz)的curl,来进行源码编译。
编译的依赖,openssl和openssl-devel。
编译方法和其他软件类似,步骤如下:
去到源码目录:curl-7.28.1
./configure --without-nss --with-ssl && make &&make install 即可完成编译。

然后是把curl的lib添加到PATH中,这个也是在google group里面说到的。
ldconfig(echo "/usr/local/lib" >> /etc/ld.so.conf && 这个有时候需要重启服务器后,再次执行这个命令.重启有问题,还是按下面的标准更新流程来!)

此时,通过命令行运行php调用curl 带证书访问web的php程序可以正常了。但是通过web界面还是之前那个Unable to load client key -8178 问题,需要重新编译php。

====

最新流程2018-05-14

先yum update openssl

再yum update curl

curl -V 

如果直接显示已经是OpenSSL版本了

重启一下php-fpm即可,不需要下面的方式。。。

上面的yum方式不行的话,走这个更新流程

1、系统的curl生成

wget http://curl.haxx.se/download/curl-7.35.0.tar.gz
tar -zxvf  curl-7.35.0.tar.gz
cd  curl-7.35.0.tar.gz

cd /www/src/curl-7.39.0
./configure --prefix=/usr/local/curl --without-nss --with-ssl
make && make install

备份默认的curl二进制文件
sudo mv /usr/bin/curl /usr/bin/curl.bak
然后做一个新的curl软链
sudo ln -s /usr/local/curl/bin/curl /usr/bin/curl

然后再curl --version确认是否已经是openssl的版本

2、生成curl.so

cd /www/src/lanmp/php-5.2.17/ext/curl
/www/wdlinux/php/bin/phpize
./configure --with-php-config=/www/wdlinux/php/bin/php-config --with-curl=/usr/local/curl/

make && make install

3、重新编译php(php.ini找出原先的配置参数,复制,去掉with-curl,然后编译

cd /www/src/lanmp/php-5.2.17/

./configure  '--prefix=/www/wdlinux/apache_php-5.2.17' '--with-config-file-path=/www/wdlinux/apache_php-5.2.17/etc' '--with-mysql=/www/wdlinux/mysql' '--with-iconv=/usr' '--with-mysqli=/www/wdlinux/mysql/bin/mysql_config' '--with-pdo-mysql=/www/wdlinux/mysql' '--with-freetype-dir' '--with-jpeg-dir' '--with-png-dir' '--with-zlib' '--with-libxml-dir=/usr' '--enable-xml' '--disable-rpath' '--enable-discard-path' '--enable-inline-optimization'  '--enable-mbregex' '--enable-mbstring' '--with-mcrypt=/usr' '--with-gd' '--enable-gd-native-ttf' '--with-openssl' '--with-mhash' '--enable-ftp' '--enable-bcmath' '--enable-exif' '--enable-sockets' '--enable-zip' '--with-apxs2=/www/wdlinux/apache/bin/apxs'

4、编译完后,在php.ini里增加

extension=curl.so

重启php-fpm即可

=====

如果你在linux服务器经常需要安装新的php应用,那难免会遇到需要重新编译php,给它增加新的功能的情况。重新编译php后,一方面需要替换掉原来的php,另一方面需要保障其他在线网站的正常运转,就需要对php进行平滑替换了。这个过程该如何进行呢?给出一点我在这方面积累的经验。

1、找出原来php的配置参数

~:php -i|grep configure
Configure Command =>  './configure'  '--prefix=/usr/local/php' '--enable-mbstring' '--enable-fastcgi' '--enable-fpm' '--with-curl' '--with-mysql=/usr/local/mysql' '--with-mysqli=/usr/local/mysql/bin/mysql_config'

./configure  '--prefix=/www/wdlinux/apache_php-5.2.17' '--with-config-file-path=/www/wdlinux/apache_php-5.2.17/etc' '--with-mysql=/www/wdlinux/mysql' '--with-iconv=/usr' '--with-mysqli=/www/wdlinux/mysql/bin/mysql_config' '--with-pdo-mysql=/www/wdlinux/mysql' '--with-freetype-dir' '--with-jpeg-dir' '--with-png-dir' '--with-zlib' '--with-libxml-dir=/usr' '--enable-xml' '--disable-rpath' '--enable-discard-path' '--enable-inline-optimization' '--with-curl=/usr/local/curl' '--enable-mbregex' '--enable-mbstring' '--with-mcrypt=/usr' '--with-gd' '--enable-gd-native-ttf' '--with-openssl' '--with-mhash' '--enable-ftp' '--enable-bcmath' '--enable-exif' '--enable-sockets' '--enable-zip' '--with-apxs2=/www/wdlinux/apache/bin/apxs'

centos curl版本nss改成openssl的更多相关文章

  1. 把centos 网卡接口eth2改成eth0

    kvm 虚拟机 复制之后 默认网卡是 eth2了 用 ifconfig -a 命令查看所有的网络设置,果然没有eth0的相关设置,多出来一个eth2.显示如下:[root@neal ~]# ifcon ...

  2. python改成了python3的版本,那么这时候yum就出问题了

    既然把默认python改成了python3的版本,那么这时候yum就出问题了,因为yum貌似不支持python3,开发了这个命令的老哥也不打算继续写支持python3的版本了,所以,如果和python ...

  3. MFC下debug改成release版本出现问题及解决办法

    自己在debug下成功运行了自己写的测试自己写第三方库的程序,这里有用到opencv库,所以同时用到了自己的库和opencv的库,需求因为要进行速度的测试,是想要把debug改成release版本,这 ...

  4. 复利计算5.0(改成Java版本)与 单元测试

    //由于C语言版本不方便单元测试,所以改成了java版本,部分代码如下:import java.util.Scanner; public class FuLi{ public static void ...

  5. centos 升级curl版本

    1.安装repo rpm -Uvh http://www.city-fan.org/ftp/contrib/yum-repo/rhel6/x86_64/city-fan.org-release-2-1 ...

  6. 【转】centos升级curl版本

    1.安装repo rpm -Uvh http://www.city-fan.org/ftp/contrib/yum-repo/rhel6/x86_64/city-fan.org-release-2-1 ...

  7. Cocos2dx 3.1.1 将一个2.X的项目改成3.1版本

    最近在论坛上下载到了一个Cocos2dx的单机跑酷例子, 也不知道是2.x版的, 花了一天时间试着把他改成3.1.1的试试, 现在已经可以顺利编译的, 但是还是有Heap Free的问题,调试了好几天 ...

  8. java1.8 版本改成 java1.7版本

    以前先安装的java1.7 大部分程序应该都是只支持1.7 不支持1.8 但是因为要跑一个别人的项目 要求是java1.8 所以想在电脑上同时装1.7和1.8 到官网上下载1.8 安装 安装完成后 并 ...

  9. 更新centos curl

    centos curl 默认使用nss,而不是openssl 升级curl让curl支持openssl rpm -Uvh http://www.city-fan.org/ftp/contrib/yum ...

随机推荐

  1. lhgdialog 与后台交互的对话框

    官网:http://www.lhgdialog.com/ 1. 调用打开dialog的按钮 <span class="txtdec fs10 open"> <a ...

  2. JavaScript 编写多线程代码引用Concurrent.Thread.js(转)

    这是一个很简单的功能实现: <script type="text/javascript" src="Concurrent.Thread.js">&l ...

  3. Sobel边缘检测算法(转载)

    转载请注明出处:  http://blog.csdn.net/tianhai110 索贝尔算子(Sobel operator)主要用作边缘检测,在技术上,它是一离散性差分算子,用来运算图像亮度函数的灰 ...

  4. 今天想把iphone4刷成ios7.3beta,折腾半天,成功

    今天想把iphone4刷成ios7.3beta,折腾半天,成功 总结如下 1 确认你是无锁机,要是有锁的,就先算了吧.我手里的是台版的无锁,这关过了. 2 得是干净非越狱的,一开始是4.2.1版本的越 ...

  5. 一个好用的Log管理类

    public class L { private static String className; //所在的类名 private static String methodName; //所在的方法名 ...

  6. Codeforces Testing Round #8 B. Sheldon and Ice Pieces 水题

    题目链接:http://codeforces.com/problemset/problem/328/B 水题~ #include <cstdio> #include <cstdlib ...

  7. tyvj1017 - 冗余关系 ——并查集

    题目链接:https://www.tyvj.cn/Problem_Show.aspx?id=1017 并查集 #include <cstdio> #include <cstdlib& ...

  8. C专家编程学习 1

    1.C语言的基本数据类型直接与底层硬件相对应. 2#define 是可能出现问题 1 2 3 4 5 #define a(y) a_ex(y) a(x)被扩展为 a_ex(x)   #define a ...

  9. Codeforces Round #136 (Div. 2)

    A. Little Elephant and Function 逆推. B. Little Elephant and Numbers \(O(\sqrt n)\)枚举约数. C. Little Ele ...

  10. hadoop删除节点

    1.修改Master节点Hdfs-site.xml,增加dfs.hosts.exclude参数 eg: <property> <name>dfs.hosts.exclude&l ...