无法连接到ssl

时间:2012-01-13 05:24:08

标签: php ssl openssl gdata

我已经使用wamp(Apache服务器)配置了openssl。但是当我使用gdata api时,我遇到了以下错误。

( ! ) Fatal error: Uncaught exception 'Zend_Http_Client_Adapter_Exception' with message ' in C:\Zend_1_11_11\library\Zend\Http\Client\Adapter\Socket.php on line 234
( ! ) Zend_Http_Client_Adapter_Exception: Unable to Connect to ssl://accounts.google.com:443. Error #10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in C:\Zend_1_11_11\library\Zend\Http\Client\Adapter\Socket.php on line 234

有人帮我这个......

3 个答案:

答案 0 :(得分:1)

来自 Mikhail 的回答对我不起作用,因为我在Alpine Linux中运行它.dll只是Windows扩展。不要在Windows之外使用它,它只会添加警告。

解决了我的问题:

我有一张无法建立连接的自签名证书。

要检查是否有问题,您可以提出请求:

wget方式:

// not working:
wget https://accounts.google.com:443
// working:
wget https://accounts.google.com:443 --no-check-certificate

或卷曲方式:

// not working:
curl https://accounts.google.com:443
// working:
curl https://accounts.google.com:443 -k

要在我的dev docker容器中临时解决它,我已经添加了curl适配器的使用,并且没有检查证书到代码:

    $config = array(
        'adapter'     => 'Zend_Http_Client_Adapter_Curl',
        'curloptions' => [CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false]
    );
    $client = new Zend_Http_Client('https://example.com', $config);

答案 1 :(得分:0)

你是代理的后面,所以你不能直接连接。尝试使用Zend / Http / Client / Adapter / Proxy.php而不是Zend \ Http \ Client \ Adapter \ Socket.php

答案 2 :(得分:0)

如果您使用 Ubuntu,请尝试添加您的 php.ini

openssl.capath=/etc/ssl/certs

For more info read this issue