PHP_NETWORK_GETADDRESSES: GETADDRINFOFAILED solution. When collecting FTP data, you need to use a PHP function ftp_connect, which establishes a new FTP connection. if a connection id is returned successfully, if it fails, FALSE is returned. a PHP function ftp_connect is required for FTP data collection. this function creates a new FTP connection. if it succeeds, a connection id is returned, otherwise, FALSE is returned.
Ftp_connect () opens an FTP connection. the host parameter is the server to be connected. The host must not end with a slash, nor must it start with ftp. The optional parameter port is the port number of the FTP server to be connected. if it is not set or 0, the default port 21 is used for connection.
When I run my program, the following error is reported:
The code is as follows:
PHP Warning: ftp_connect (): php_network_getaddresses: getaddrinfo failed:
I often find that the problem is IPtables, so I opened the default FTP port, so it can be used normally.
In this case, you must first check the services on your server, and then the firewall.
FTP connection. if the connection is successful, a connection identifier is returned. if the connection fails, FALSE is returned...