无法连接到 ssl

发布于 2024-12-26 14:38:23 字数 649 浏览 2 评论 0原文

我已经使用 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

有人帮我解决这个问题...

I have configured the openssl with wamp (Apache server). But while I using gdata api I'm getting following error.

( ! ) 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

Somebody help me on this...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

凉城凉梦凉人心 2025-01-02 14:38:24

仅适用于 Windows 用户的解决方案:

检查 php.ini 中是否启用了 SSL 模块:

extension=php_openssl.dll

Solution only for Windows users:

Check the SSL module is enabled in php.ini:

extension=php_openssl.dll
逆流 2025-01-02 14:38:24

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

解决了我的问题

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

要检查这是否是问题,您可以发出请求:

wget way:

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

或curl way:

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

为了在我的开发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);

Answer from Mikhail does not work for me as I run it in Alpine Linux and .dll is only windows extension. Do not use it outside of Windows, it only adds warnings.

Solved my problem:

I had a self-signed certificate that was unable to establish connection.

To check that it is problem you can make a request:

wget way:

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

or curl way:

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

To temporary solve it in my dev docker container, I have added use of curl adapter and no check for certificate to the code:

    $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);
别念他 2025-01-02 14:38:24

您位于代理后面,因此无法直接连接。尝试使用 Zend/Http/Client/Adapter/Proxy.php 而不是 Zend\Http\Client\Adapter\Socket.php

You are behind proxy, so you can not connect directly.Try to use Zend/Http/Client/Adapter/Proxy.php instead of Zend\Http\Client\Adapter\Socket.php

℡Ms空城旧梦 2025-01-02 14:38:24

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

openssl.capath=/etc/ssl/certs

有关更多信息,请阅读这个问题

If you on Ubuntu try add in your php.ini

openssl.capath=/etc/ssl/certs

For more info read this issue

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文