This error is caused by bad credentials, if your hostname, username or password are wrong.
Or if the server is not accepting your connection.
To retrieve the error, add this code: or die(“Unable to connect to server.”); after $conn_id = ftp_connect($ftp_server).
The server can also deny the connections if you make more than one and you make them in very small intervals (seconds). To solve this issue, add sleep(60); before each connection.
sleep(60); is for making your script to wait 60 seconds before moving to the next lines of code (the next ftp connection).