Welcome Guest, Not a member yet? Register   Sign In
[Solved] Unable to connect to your FTP server using the supplied hostname.
#1

[eluser]jurosik[/eluser]
Hi, I'm tryin' to set up ftp connection in my script, but there is some simple (for me unknown) problem.

I am connecting via script from UserGuide:
Code:
$this->load->library('ftp');

$config['hostname'] = 'ftp.dreamweb.sk';
$config['username'] = 'myusername';
$config['password'] = 'mypassword';
$config['port']     = 21;
$config['passive']  = FALSE;
$config['debug']    = TRUE;

$this->ftp->connect($config);
        
$list = $this->ftp->list_files('/public_html/');

print_r($list);
        
$this->ftp->close();

and the error is: Unable to connect to your FTP server using the supplied hostname.

Any idea? I tried many modifications of hostname from dreamweb.sk to ftp://www.dreamweb.sk and many more, but no one works...
#2

[eluser]Matthew Lanham[/eluser]
Seems strange, have you tried setting passive to TRUE as maybe a firewall is blocking the communication
#3

[eluser]jurosik[/eluser]
Yes I tried passive mode... still the same error, i don't know where could be problem... :question:
#4

[eluser]CI Lee[/eluser]
For your username try
Code:
$config['username'] = '[email protected]';

-Lee
#5

[eluser]sandwormusmc[/eluser]
Stupid question, but can you connect via another FTP client to the host from the box your code is running on?
#6

[eluser]jurosik[/eluser]
to CI Lee: my username is [email protected], i tried it change to [email protected]@ftp.dreamweb.sk, but nothing changed, the same error...

to sandwormusmc: yes, i am connecting via transmit FTP with same data and it works...
#7

[eluser]Pygon[/eluser]
just a note.... in order to use FTP, your php must be compiled "--enable-ftp". You might consider testing whether you can actually use "ftp_connect" seperately from CI to make sure that isn't causing a problem.
#8

[eluser]jurosik[/eluser]
Thank you for your time guys, problem is with my hosting provider, the hostname should be set to 127.0.0.1... now it works
#9

[eluser]sandwormusmc[/eluser]
That makes sense. Your code was connecting to the box it was actually running on, not an external one ... so 'localhost' or 127.0.0.1 would have worked.




Theme © iAndrew 2016 - Forum software by © MyBB