在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'

最新文章

  1. redis3.0.6安装(linux和windows)
  2. VC 单文档视图分割
  3. Macaca-iOS入门那些事2
  4. java数学函数库 API(转)
  5. 阻塞队列LinkedBlockingQueue和并发队列ConcurrentLinkedQueue
  6. Unable to open file 'TYPES.OBJ'
  7. python 学习5--matplotlib画图实践
  8. Unieap3.5错误收集
  9. JProtector java应用加密工具
  10. POJ3313 【随便写了个spfa就一A了,嗨皮】
  11. WCF搭建
  12. echarts图表属性设置
  13. java中全角半角字符的相互转换的代码
  14. H3C IRF MAD检测原理及相关问题验证
  15. 小兔的棋盘(hdu2067)
  16. qml: 多级窗口visible现象;
  17. cad2016卸载/安装失败/如何彻底卸载清除干净cad2016注册表和文件的方法
  18. HDU4704(SummerTrainingDay04-A 欧拉降幂公式)
  19. AI-Tank
  20. CSS3----实现毛玻璃完美效果

热门文章

  1. 第一个Sprint冲刺第十天
  2. cJSON_hacking
  3. shell脚本-获取时间
  4. Codeforces Round #298 (Div. 2) B. Covered Path
  5. emulator: ERROR: Unable to load VM from snapshot. The snapshot has been saved for a different hardware configuration.
  6. win7 一些快捷系统工具命令
  7. Java-->多线程断点续传
  8. Android EditText内容监听
  9. hdu4642 Fliping game ——博弈
  10. android:versionCode和android:versionName 用途