Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.