Jump to content

[SOLVED] Basic FTP issues


rhyspaterson

Recommended Posts

Hey guys,

 

Running a really simple script here

 

$FTPserver = "xxx.xxx.xxx.xxx";
$FTPuser ="xxxxxxx";
$FTPpass ="xxxxxxx"; 

$ftp = ftp_connect($FTPserver) or die ("Can't connect to FTP Server : $FTPserver");
$login = ftp_login($ftp, $FTPuser, $FTPpass) or die ("Can't login to FTP Server : $FTPServer"); 

 

I get the first error (can't connect). However when i connect through a browser (ftp://xxx.xxx.xxx.xxx) it works fine.

 

Obviously im missing something fundamental here. Can anyone point me in the right direction?

 

Cheers,

/Rhys

Link to comment
https://forums.phpfreaks.com/topic/52895-solved-basic-ftp-issues/
Share on other sites

Thanks for your quick replies. Tried the above code suggested however the connection still failed.

 

The Linux box is sitting next to me so contacting the host is not really an issue (the host being me, haha). The FTP port is allowing connections.

 

Hmm, confused i am.

Hey guys,

 

Sorry the PHP was running on my box and connecting to a separate box. I found the problem however. FTP was denying connections that were not local. The box i was running the PHP FTP connection off was located off site somewhere. Was a simple process of changing the hosts file to accept FTP connections from the IP address.

 

Thanks so much for your help guys. Whoever mentioned the external IP put me on the right path.

 

Cheers,

/Rhys

 

edit: looking for the 'solved' button but cant find it

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.