RE: FTP Problems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ah - whoops - just worked out why - you need to set the passive mode after
you login, not after a connect! Silly solution!

-----Original Message-----
From: James Nunnerley [mailto:webmaster@xxxxxxxxxxx] 
Sent: 27 June 2006 14:37
To: 'Jochem Maas'
Cc: 'chris smith'; php-general@xxxxxxxxxxxxx
Subject: RE:  FTP Problems

Thanks all - it would seem that php is failing to set the passive mode to
true - I can get around it temporarily, but need to find a more permanent
option.

Does anyone have any experience as to why setting ftp_pasv to true fails?

-----Original Message-----
From: Jochem Maas [mailto:jochem@xxxxxxxxxxxxx] 
Sent: 27 June 2006 14:29
To: James Nunnerley
Cc: 'chris smith'; php-general@xxxxxxxxxxxxx
Subject: Re:  FTP Problems

James Nunnerley wrote:
> Thanks for the reply Chris.
> 
> How would you suggest displaying the current "home" directory for the
user?
> I've tried / and indeed the "real" directory name on that particular
server.

you could try '~/' (or maybe just'~') as the dir name which equates to the
'the current users homedir' when you in a shell - no idea whether that is
even allowable
when going in via ftp but might be worth a shot though - given what you have
been saying in your thread one would hazard to guess that the ftp server
your
working with is a little borked (but that a gut feeling).


> 
> Funnily enough, I've also just tried a generic php/ftp script tool, and it
> works on a third party server into the one I'm trying to connect to, but
not
> from the server I'm working on!
> 
> Is there anyway in which php needs configuring for certain connections?
> 
> -----Original Message-----
> From: chris smith [mailto:dmagick@xxxxxxxxx] 
> Sent: 27 June 2006 14:16
> To: James Nunnerley
> Cc: php-general@xxxxxxxxxxxxx
> Subject: Re:  FTP Problems
> 
> On 6/27/06, James Nunnerley <webmaster@xxxxxxxxxxx> wrote:
>> I'm trying to create some functionality which requires FTPing onto
another
>> server, using the php functions.
>>
>> Doing the following comes up with a successful login, but cannot display
> the
>> current directory; yet when I FTP directory from the server which is
> serving
>> the php pages, it works fine.
>>
>> // set up basic connection
>> $conn_id = ftp_connect($ftp_server, 21);
>> ftp_pasv($conn_id, true);
>>
>> // login with username and password
>> $login_result = ftp_login($conn_id, $username, $password);
>>
>> // check connection
>> if ((!$conn_id) || (!$login_result)) {
>>
>> echo "FTP connection has failed!";
>> echo "Attempted to connect to $ftp_server for user $username<br />";
>> exit;
>>
>> } else {
>>
>> echo "Connected to $ftp_server, for user $username<br />";
>>
>> }
>>
>> echo(ftp_pwd($conn_id)."<br />"); # Comes back with /
>>
>> $buff = ftp_nlist($conn_id,"");
> 
> ftp_nlist requires a directory name. A blank string is not a directory
name.
> 
> http://au.php.net/ftp_nlist
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux