Welcome to WebmasterWorld Guest from 54.162.12.134

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Problems with ftp connect

Issue with ftp_connect

     
9:06 pm on Dec 12, 2008 (gmt 0)

5+ Year Member



Greetings, I am new to PHP and I am having issues with the ftp_connect command. My site is hosted by a 3rd party and I am able to ftp using ftp software and also by using IE or Firefox with ftp.mysite.com as the URL. I create simple PHP page to test the ftp connection to my hosting server.

<?php

$conn_id = ftp_connect("ftp.mysite.com")or die ("Can't connect to FTP Server");

echo'successful connection';

ftp_close($conn_id);
?>

When called, I get the "Can't connect.." - the die statement. I would appriciate any suggestions.

2:53 am on Dec 13, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Perhaps you need username and password for that server?
12:31 am on Dec 18, 2008 (gmt 0)

5+ Year Member



Thanks. I tried the following without success.

<?php

ini_set('displat_errors',1);
error_reporting(E_ALL & ~E_NOTICE);

$ftp_login = 'login';
$ftp_password = 'password';

$conn_id = ftp_connect("ftp.mysite.com",21)or die ("Can't connect to FTP Server");
$login_result = ftp_login($conn_id, $ftp_login, $ftp_password)or die ("Can't login to FTP Server");

echo'successful connection';

ftp_close($conn_id);

?>

Any suggestions?
I have tried "firewall.mysite.com also without success. can not get past the ftp_connect() command. It keeps going to the die command.

7:03 am on Dec 18, 2008 (gmt 0)

5+ Year Member



Dear Lit_byte,

did u check time out for the FTP server?

Thanks
Mahabub

7:43 pm on Dec 18, 2008 (gmt 0)

5+ Year Member



Mahabub -
No I haven't checked time out. I'm still a little green when it come to PHP and Servers, how might I check this? I host my site using a 3rd party.
2:46 pm on Dec 29, 2008 (gmt 0)

5+ Year Member



Lit_byte,

I am having same issues, I'm running some PHP code to remotely connect (FTP) to another 3rd party webhosting company. I also get failed to connect every time with code very similar to yours. I'm still working on it and when I get it figured out, I'll post results here. Please do the same!
Thanks

9:42 am on Jan 7, 2009 (gmt 0)

5+ Year Member



Please contact your host and ask them if they have a firewall that may be preventing you from connecting to port 21 within the server. They may need to open this on an individual basis.
3:53 pm on Jan 14, 2009 (gmt 0)

5+ Year Member



Thanks CWI Tech Guy. On the last response from my hosting company, they admitted not knowing web design or coding. I emailed them regarding access through the Firewall as you suggested, we will see what they say.
4:21 pm on Jan 14, 2009 (gmt 0)

5+ Year Member



I had the same issue with Yahoo hosting a clients website, turns out Yahoo specifically has FTP for PHP disabled. I had to use 'wget' in my PHP code to solve my issues.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month