1

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

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

                    )
                );

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

2
  • check from digitalocean, the ip might be blocked by digitalocean firewall
    – fmsthird
    Feb 24, 2019 at 13:18
  • Did you ever find why ? I have currently the same pb (not with digital ocean), and the ftp_connect works on an external script, on the same server... Apr 15, 2020 at 14:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.