i include the use \Magento\Framework\Filesystem\Io\Ftp; at the top nd connct the ftp as

 $connection = $this->ftp->open(
                        'host' => '',
                        'user' => 'admin',
                        'password' => 'test@123',
                        'passive' => true,


this code is work fine in my local environment.. But when am trying with the same code in digitalocean (SFTP) THROWS AN ERROR like

Could not establish FTP connection, invalid host or port.

please help me

  • check from digitalocean, the ip might be blocked by digitalocean firewall – fmsthird Feb 24 at 13:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.