加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

“php_connect_nonb()失败:正在进行的操作(115)”间歇性地发生

发布时间:2020-12-13 17:54:35 所属栏目:PHP教程 来源:网络整理
导读:我们通过FTP将一些文件通过 PHP cron作业发送给第三方. 但是有时我们会收到以下错误: ErrorException [ 2 ]: ftp_put(): php_connect_nonb() failed: Operation now in progress (115) ~ MODPATH/fileop/classes/Drivers/Fileop/Ftp.php [ 37 ] 当我说“有
我们通过FTP将一些文件通过 PHP cron作业发送给第三方.

但是有时我们会收到以下错误:

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

当我说“有时”时我就是这么说的;大多数情况下,它很好,但我们得到的错误大约是五分之一.这与文件本身无关,因为如果我们再试一次,他们会很开心.

我们在网上发现了类似的问题 – 与使用NAT设备的bug in PHP相关或者与防火墙配置有关,但这意味着,如果是这种情况,它将无法工作.

那么,为什么有些时候会有效呢?

FTP(S) uses random ports to set up data connections;间歇性成功率表示客户端和/或服务器计算机上的防火墙不允许所有端口.可以在FTP服务器中设置传入(PASV)数据连接的端口范围.

This page有一个很好的总结:

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!

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读