【问题标题】:Unable to connect to a server using fsockopen无法使用 fsockopen 连接到服务器
【发布时间】:2013-04-23 03:54:52
【问题描述】:

nginx 错误日志中的错误: fsockopen(): SSL operation failed with code 1. OpenSSL Error messages: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol in <file> on line <no>

我可以使用 FileZilla、WinSCP 和 ftp_ssl_connect() 进行连接。但我无法使用fsockopen("ssl://domain.com", $port, $errno, $errstr, $timeout) 进行连接。

这个命令 openssl s_client -connect domain.com:21 -starttls ftp 给了我正确的输出,但是如果我删除 STARTTLS 命令它会给出这个错误:

CONNECTED(00000003)
47404513277584:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:s23_clnt.c:766:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 7 bytes and written 321 bytes
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
---

谁能帮助我如何将 STARTTLS 命令放入我的 PHP 代码中?如果你们需要任何其他详细信息,请告诉我,我将编辑帖子。

【问题讨论】:

    标签: php ftp nginx fsockopen ftps


    【解决方案1】:

    尝试使用 465 端口。为了获得更好的答案,请提供一些信息(一些 php 代码或者如果您使用像 PhpMailer 这样的专用 php 类,请指定它)

    【讨论】:

      猜你喜欢
      • 2018-07-05
      • 2021-05-17
      • 2012-02-21
      • 2021-03-08
      • 2013-05-30
      • 1970-01-01
      • 2017-02-21
      • 2019-11-24
      • 2015-03-14
      相关资源
      最近更新 更多