“php_connect_nonb()失败:正在进行操作(115)”间歇性地发生 [英] "php_connect_nonb() failed: Operation now in progress (115)" happens intermittently

查看:1812
本文介绍了“php_connect_nonb()失败:正在进行操作(115)”间歇性地发生的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们通过FTP将一些文件发送给第三方并使用PHP cron作业。



然而,有时我们会收到以下错误消息:

  ErrorException [2]:ftp_put():php_connect_nonb()失败:操作
正在执行(115)〜MODPATH / fileop / classes / Drivers /Fileop/Ftp.php [37]

当我说有时候大多数时候它都很好,但大约有五分之一我们得到这个错误。这与文件本身无关,因为如果我们再次尝试,它们会很开心。

我们在网上发现了类似的问题 - 与 PHP中的错误与NAT设备或与防火墙配置,但同样的含义是,如果是这种情况,它会永远不会 work。



那么,为什么这个工作会有一些时间,而不是其他的?

解决方案

FTP(S)使用随机端口来建立数据连接;间歇成功率表示并非所有端口都被客户端和/或服务器上的防火墙所允许。传入(PASV)数据连接的端口范围可以在FTP服务器中设置。



本页面有一个很好的总结:


简单的方法是简单地允许FTP服务器和客户端无限
通过防火墙访问,但如果您想限制他们访问
已知端口,则必须了解4种不同情况。



1)应允许FTP服务器接受TCP连接以端口
21,并从端口20到任何(远程临时)
端口建立TCP连接。



2)应该允许FTP服务器接受TCP连接以端口
21,并且接受到任何临时端口的TCP连接!



3)应允许FTP客户端建立到端口
21的TCP连接,并接受从端口20到任何临时端口的TCP连接。



4)FTP应允许客户端建立到端口
21的TCP连接,并建立与任何其他(远程临时)端口
的TCP连接!



We send some files across to a third party with a PHP cron job via FTP.

However sometimes we get the following error:

ErrorException [ 2 ]: ftp_put(): php_connect_nonb() failed: Operation 
now in progress (115) ~ MODPATH/fileop/classes/Drivers/Fileop/Ftp.php [ 37 ]

When I say "sometimes" I mean exactly that; most times it goes across fine but about 1 in 5 times we get that error. It's not to do with the files themselves, because they will go happily if we try again.

We've found similar issues online - relating to a bug in PHP with NAT devices or to do with firewall configuration but again the implication is that if this were the case it would never work.

So, why would this work some times and not others?

解决方案

FTP(S) uses random ports to set up data connections; an intermittent success rate indicates that not all ports are allowed by a firewall on the client and/or server machines. The port range for incoming (PASV) data connections can be set in the FTP server.

This page has a nice summary:

The easy way is to simply allow FTP servers and clients unlimited access through your firewall, but if you like to limit their access to "known" ports, you have to understand the 4 different scenarios.

1) The FTP server should be allowed to accept TCP connections to port 21, and to make TCP connections from port 20 to any (remote ephemeral) port.

2) The FTP server should be allowed to accept TCP connections to port 21, AND to accept TCP connections to any ephemeral port as well!

3) The FTP client should be allowed to make TCP connections to port 21, and to accept TCP connections from port 20 to any ephemeral port.

4) The FTP client should be allowed to make TCP connections to port 21, and to make TCP connections to any other (remote ephemeral) port as well!

这篇关于“php_connect_nonb()失败:正在进行操作(115)”间歇性地发生的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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