osx 10.10 Curl POST到HTTPS网址给出了SSLRead()错误 [英] osx 10.10 Curl POST to HTTPS url gives SSLRead() error

查看:217
本文介绍了osx 10.10 Curl POST到HTTPS网址给出了SSLRead()错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近升级到OSX 10.10 Yosemite和我从升级后我不能做curl POST到SSL url。

I just recently upgraded to OSX 10.10 Yosemite and I since the upgrade I can't do Curl POST to a SSL url anymore.

我第一次使用wordpress的 wp_remote_request 调用,并尝试在PHP中使用curl。
两个(如预期的)给出相同的错误消息:

I first used wordpress's wp_remote_request call and also tried to use curl in php. Both (as expected) give the same error message:


错误号码:56

Error Number:56

错误字符串:SSLRead()返回错误-9806

Error String:SSLRead() return error -9806

注意:当我将POST压缩到HTTP时, 。
我认为这是一个设置在PHP.ini或在我的apache(我升级后丢失了原来的HTTPD.conf文件...)。

Note: when I curl POST to HTTP it works fine. I reckon it is a setting in PHP.ini or in my apache (I lost my original HTTPD.conf file after upgrade...).

任何人帮助我?

推荐答案

我看到这个错误发生时,php是编译的版本的cURL使用 Yosemite下的Apple的安全传输以及网址请求的目标不支持SSLv3(可能由于 POODLE漏洞)。这个命令的输出是什么?

I've seen this error happen when php is compiled with a version of cURL that uses Apple's Secure Transport under Yosemite and the target of the URL request doesn't support SSLv3 (which was probably disabled due to the POODLE vulnerability). What is the output of this command?

$ php -i | grep "SSL Version"

我怀疑你会看到:

SSL Version => SecureTransport



您可以通过安装一个版本的php来克服这个问题,该版本使用的是使用OpenSSL的cURL版本的SecureTransport。使用自制软件最方便。所以安装第一,如果你还没有它。如果安装了自制软件,但自升级到Yosemite后,您还没有运行 brew update ,请先执行。还要确保你已经安装XCode> = 6.1和最新的XCode命令行工具。 brew医生会告诉您是否已经完成。

You can overcome this by installing a version of php which uses a version of cURL which uses OpenSSL instead of SecureTransport. This is most easily done with homebrew. So install that first if you don't already have it. If homebrew is installed but you haven't run brew update since upgrading to Yosemite, do that first. Also make sure you've installed XCode >= 6.1 and the latest XCode command line tools. brew doctor will tell you if you've done it all right.

在下面添加Homebrew水龙头需要为了得到酿造的php安装。如果已经轻敲这些回复,请跳过此步骤。如果你不确定这些repos是否已经被点击,只需运行下面的命令。最坏的情况下,你会得到一个无害的警告:已经点击!

Add the Homebrew taps below that you will need in order to get brewed php installed. Skip this step if these repos are already tapped. If you're unsure if these repos are already tapped, just run the commands below. Worst case scenario, you'll get a harmless Warning: Already tapped!

$ brew tap homebrew/dupes
$ brew tap homebrew/versions
$ brew tap homebrew/php

然后使用openssl安装curl:

Then install curl with openssl:

$ brew install --with-openssl curl

然后使用刚刚安装的curl安装php,并调用openssl:

Then install php using the curl you just installed and brewed openssl:

$ brew install --with-homebrew-curl --with-httpd24 php55




  • 如果使用apache,请确保添加 LoadModule php5_module /usr/local/opt/php55/libexec/apache2/libphp5.so /etc/apache2/httpd.conf 并重新启动apache。

    • if using apache, make sure to add LoadModule php5_module /usr/local/opt/php55/libexec/apache2/libphp5.so to your /etc/apache2/httpd.conf and restart apache.

      如果不使用apache 2.4,可以从上面的命令中删除 - with-httpd24

      if not using apache 2.4, you can remove --with-httpd24 from the above command.

      如果使用nginx,请按照说明启动fpm的说明:

      if using nginx, follow the caveat instuctions for starting fpm:


      在启动时启动php-fpm:

      To launch php-fpm on startup:

      mkdir -p ~/Library/LaunchAgents
      cp /usr/local/opt/php55/homebrew.mxcl.php55.plist ~/Library/LaunchAgents/
      launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php55.plist
      



    • 安装任何你需要的php扩展。 mcrypt

      Install any php extensions you're going to need eg. mcrypt.

      $ brew install php55-mcrypt
      

      完成后,再次执行此操作:

      After you're done, run this again:

      $ php -i | grep "SSL Version"
      

      您应该会看到:

      SSL Version => OpenSSL/1.0.2h
      

      现在,重新测试你的应用程序和 SSLRead()返回错误-9806 应该消失。

      And now, re-test your application and the SSLRead() return error -9806 should go away.

      这篇关于osx 10.10 Curl POST到HTTPS网址给出了SSLRead()错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆