"Php_connect_nonb () error: operation performed (115)" occurs intermittently

We send files to third parties with the task of PHP cron 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 just that; in most cases, it goes through a fine, but about 1 time in 5 times we get this error. This does not apply to the files themselves, because they will go happily if we try again.

We found similar problems on the Internet related to a bug in PHP with NAT devices or to setting up a firewall, but again it is understood that if this were the case, it would never work.

So, why does it work several times and not others?

+7
source share
2 answers

FTP (S) uses random ports to configure data connections ; intermittent success rates indicate that not all ports are allowed by the firewall on client and / or server machines. The port range for inbound (PASV) data connections can be set on the FTP server.

This page has a nice summary:

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

1) The FTP server is allowed to accept TCP connections to port 21 and make TCP connections from port 20 to any (remote ephemer) port.

2) The FTP server should be allowed to accept TCP connections to port 21, and also accept TCP connections with any ephemeral port!

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

4) The FTP client must be allowed to connect the TCP port to port 21, as well as to connect TCP to any other (remote ephemeral) port as well!

+2
source

So, I am writing this answer after some investigation on my FTP server and reading the link that you provided elitehosts.com.

I am using FileZilla FTP server, and there is a specific setting that I had to enter in order for it to work. In the server settings there is an area called "Passive Mode Settings". In this dialog box there is an area called "IPv4 Specification", and in this area there is the option "IP address of the external server for passive mode transfer:". He set the switch, and it was turned on “By default,” but since the FTP server is NAT'ed, I changed this radio from “Default” to “Use the following IP address” and entered my gateway address into the external IP address provided by my provider.

After I installed it, it worked! I’m not terribly sure that your FTP server is NAT'ed, but I thought I would give an answer to this stream because it seems to be connected.

+1
source

All Articles