homepage Welcome to WebmasterWorld Guest from 54.204.58.87
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Problems with ftp connect
Issue with ftp_connect
Lit_byte




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

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.

 

eeek




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

Perhaps you need username and password for that server?

Lit_byte




msg:3809951
 12:31 am on Dec 18, 2008 (gmt 0)

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.

Mahabub




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

Dear Lit_byte,

did u check time out for the FTP server?

Thanks
Mahabub

Lit_byte




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

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.

JaaFive




msg:3815572
 2:46 pm on Dec 29, 2008 (gmt 0)

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

CWI Tech Guy




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

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.

Lit_byte




msg:3826186
 3:53 pm on Jan 14, 2009 (gmt 0)

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.

JaaFive




msg:3826213
 4:21 pm on Jan 14, 2009 (gmt 0)

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved