ftp_nlist():data_accept:SSL/TLS握手失败 [英] ftp_nlist(): data_accept: SSL/TLS handshake failed

查看:101
本文介绍了ftp_nlist():data_accept:SSL/TLS握手失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从前,PHP领域出现了正常错误:

Once upon a time, there was a normalish error in PHP land:

警告:ftp_nlist():data_accept:第29行的[path]中的SSL/TLS握手失败

Warning: ftp_nlist(): data_accept: SSL/TLS handshake failed in [path] on line 29

但这是要注意的问题,第29行"不是连接或登录名,请注意它是如何引用ftp_nlist()函数的:

But here's the catch, "line 29" is not the connection or login, note how it referenced the ftp_nlist() function:

$ftp = ftp_ssl_connect($cred['host'], $cred['port'], 180);
if (!ftp_login($ftp, $cred['user'], $cred['pass'])) {die("Login Failed");}
ftp_pasv($ftp, true);

$files = ftp_nlist($ftp, '');

OpenSSL已在phpinfo()中编译并启用,如下所示: ftp_login():SSL/TLS握手失败

OpenSSL is compiled and enabled in phpinfo() as suggested here: ftp_login() : SSL/TLS handshake failed

我见过的其他帖子似乎都引用了对我有用的ftp_ssl_connect()ftp_login()命令中的错误. ftp_login()返回true时,我该怎么检查?

Other posts I've seen all seem to reference error in the ftp_ssl_connect() or ftp_login() commands which work for me. What can I check when ftp_login() returns true?

或者...是否有任何日志可获取有关出了什么问题的更多详细信息?

Or... are there any logs to get more details on what is wrong?

我正在使用php 5.3.29.该代码可以在我的桌面(php 7)上正常工作,但是我希望不必将服务器升级到7即可

I'm using php 5.3.29. The code does work properly on my desktop (php 7), but I'm hoping I don't have to upgrade the server to 7 for this to work

2017年12月28日更新: 升级到5.6可以解决,因此看起来马丁就可以了.

12-28-2017 update: Upgrading to 5.6 resolved, so looks like Martin is on point.

推荐答案

ftp_nlist打开数据连接.该连接也需要TLS/SSL握手.

The ftp_nlist opens a data connection. That connection needs TLS/SSL handshake too.

随着控制连接握手成功,PHP中缺少TLS/SSL支持的确不会出现问题.服务器和PHP之类的东西都找不到与之达成共识的密码,这都不是问题.

As the control connection handshake succeeded, the problem indeed cannot be with an absent TLS/SSL support in PHP. Neither the problem can be with anything like the server and PHP not being able to find a cipher to agree on.

在控制连接上的握手成功后,当数据连接上的TLS/SSL握手失败时,通常是因为客户端(PHP)没有在数据连接上重用来自控制连接的TLS/SSL会话(请参阅 PHP错误70195 .因此,请确保至少使用该版本的PHP.

When TLS/SSL handshake on data connection fails after handshake on control connection succeeded, it's quite usually because the client (PHP) did not reuse TLS/SSL session from control connection on the data connection (see Why is session reuse useful in FTPS?). Some servers do require that. PHP supports the reuse only since 5.6.26. See PHP Bug 70195. So make sure you use that version of PHP at least.

这篇关于ftp_nlist():data_accept:SSL/TLS握手失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆