我最近刚升级到OSX 10.10优胜美地,自从升级后我再也不能向SSL url发送Curl帖子了.

我第一次使用wordpress的wp_remote_request调用,还try 在php中使用curl.

错误号:56

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

注意:当我将帖子curl 到HTTP时,它可以正常工作.

有人能帮我吗?

推荐答案

当php使用Yosemite下使用Apple's Secure Transport的cURL版本编译时,我看到了这个错误,URL请求的目标不支持SSLv3(这可能是由于POODLE vulnerability而禁用的).这个命令的输出是什么?

$ php -i | grep "SSL Version"

我猜你会看到:

SSL Version => SecureTransport

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.

在下面添加您需要的brew 龙头,以便安装brewed php.如果这些回购协议已经敲定,请跳过此步骤.如果你不确定这些回购协议是否已经被点击,只需运行下面的命令.最坏的情况下,你会得到一个无害的Warning: Already tapped!

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

然后使用openssl安装curl:

$ brew install --with-openssl curl

然后使用刚刚安装并制作的openssl安装php:

$ brew install --with-homebrew-curl --with-httpd24 php55
  • 如果使用Apache,请确保在/etc/apache2/httpd.conf中添加LoadModule php5_module /usr/local/opt/php55/libexec/apache2/libphp5.so,然后重新启动Apache.

  • 如果不使用Apache2.4,可以从上述命令中删除--with-httpd24.

  • 如果使用nginx,请遵循启动FPM的警告说明:

    要在启动时启动php fpm:

    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.

$ brew install php55-mcrypt

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

$ php -i | grep "SSL Version"

你应该看到:

SSL Version => OpenSSL/1.0.2h

现在,重新测试你的应用程序,SSLRead() return error -9806应该消失.

Php相关问答推荐

419注册期间Laravel 11中的错误

如何使用属性#[Embedded]嵌入带有规则的对象集合?

在Woocommerce变量产品中的标签附近显示所选属性选项名称

在Laravel中为表添加前缀,以将它们逻辑地分组

如何在Livewire 3 Form类中做依赖注入?

根据WooCommerce Cart小计阈值自动应用优惠券

使用HPOS过滤WooCommerce中的订单列表

更改WooCommerce checkout 中的错误消息以获得不可用的送货方式

在WooCommerce购物车页面应用优惠券不会';t刷新总计

Shopware 6 插件:如何删除/迁移布尔配置到多选配置

过滤会员计划标题和标签

使用产品自定义字段作为 WooCommerce 中特定用户角色的折扣百分比

为什么 debug_backtrace() 不返回任何内容?

Woocommerce的数量和价格条件

为什么foreach循环会输出每个结果?

批量作业(job)提交错误无法处理所有文档,uris 似乎正确?

在 PHP 中验证签名

为什么在解压缩具有混合字符串和 int 键的关联数组时出现错误消息无法使用位置参数...?

如何在不解压缩/重新压缩的情况下连接(连接)两个缩小的值

来自命令行的 PHP 没有给出正确的结果