在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. I.MX6 KEY_ROW4 can't as GPIO pin

    /********************************************************************** * I.MX6 KEY_ROW4 can't as GP ...

  2. MBR主引导扇区解析

    最近在制作镜像的时候由于需要简单研究了下MBR主引导扇区的结构,这里记录下便于后期温习,下面就直接进入正题: MBR主引导扇区位于磁盘的第一个扇区,即0号扇区,主要由引导代码.分区表.结束标志三部分构 ...

  3. 尽量多的以 const/enum/inline 替代 #define

    前言 在面向过程语言,如 C 语言中,#define 非常常见,也确实好用,值得提倡.但在如今面向对象的语言,如 C++ 语言中,#define 就要尽量少用了. 为何在 C++ 中就要少用了呢? 这 ...

  4. 用python matplotlib 画图

    state-machine environment object-oriente interface figure and axes backend and frontend user interfa ...

  5. Python 新手常犯错误(第一部分)

    转载自:http://blog.jobbole.com/42706/ 在之前几个月里,我教一些不了解Python的孩子来慢慢熟悉这门语言.渐渐地,我发现了一些几乎所有Python初学者都会犯的错误,所 ...

  6. sql server触发器中增删改判断

    触发器生效逻辑 在Before或者After之后使用INSERT,DELETE,UPDATE 触发器内情况判断 插入 if exists(select 1 from inserted) and not ...

  7. 2015GitWebRTC编译实录8

    2015.07.20 common_video 编译通过,其对libyuv有引用[1309/1600 ] CXX obj /webrtc/common_video/libyuv/common_vide ...

  8. ZOJ 1090 The Circumference of the Circle

    原题链接 题目大意:已知三角形的三个顶点坐标,求其外接圆的周长. 解法:刚看到这道题时,马上拿出草稿纸画图,想推导出重心坐标,然后求出半径,再求周长.可是这个过程太复杂了,写到一半就没有兴致了,还是求 ...

  9. ZOJ 1241 Geometry Made Simple

    /*Mathematics can be so easy when you have a computer. Consider the following example. You probably ...

  10. scala言语基础学习十二