我最近刚升级到OSX 10.10优胜美地,自从升级后我再也不能向SSL url发送Curl帖子了.
我第一次使用wordpress的wp_remote_request
调用,还try 在php中使用curl.
错误号:56
错误字符串:SSLRead()返回错误-9806
注意:当我将帖子curl 到HTTP时,它可以正常工作.
有人能帮我吗?
我最近刚升级到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
应该消失.