FTP Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationFTP Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 8th, 2002, 06:18 PM
TheRealRodzilla TheRealRodzilla is offline
PHP Geek
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Posts: 37 TheRealRodzilla User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 sec
Reputation Power: 7
Send a message via ICQ to TheRealRodzilla
Trouble with Passive Connections and FTP Raw Lists

I have a script running that mirrors files in a certain directory to two file mirrors. It works perfectly with one of the mirrors, but with the other, I get a crapload of the same error, and it takes forever to execute:

Quote:
<br />
<b>Warning</b>: Variable passed to next() is not an array or object in <b>/home/seriousc/files/cron.php</b> on line <b>95</b><br />
<br />
<b>Warning</b>: Variable passed to next() is not an array or object in <b>/home/seriousc/files/cron.php</b> on line <b>95</b><br />
<br />
<b>Warning</b>: Variable passed to next() is not an array or object in <b>/home/seriousc/files/cron.php</b> on line <b>95</b><br />
<br />
...


And from the script, lines 90-96:
PHP Code:
function DoRemote($dirname$onlydirs 0)
{
    global 
$conn$localdir$remotedir;

    
$rlist ftp_rawlist($conn$dirname);
    while(
$dir next($rlist))
    { 


$dirname is the remote directory to get a list of, and $conn is the ftp connection. When I connected to the server with my FTP client and ran a LIST on it, I got the following:

Quote:
COMMAND:> LIST
550 Cannot open passive data connection.


So I tried turning passive mode off in the PHP script right after connecting. Still didn't work. What's wrong? It only does this for one of the mirrors - the other works perfectly.

Reply With Quote
  #2  
Old October 8th, 2002, 10:10 PM
AlCapone's Avatar
AlCapone AlCapone is offline
Mobbing Gangster
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Sep 2001
Location: "Best City" 2002 and 2003- Melbourne, Australia
Posts: 4,913 AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 h 36 m 31 sec
Reputation Power: 18
Send a message via ICQ to AlCapone Send a message via AIM to AlCapone Send a message via Yahoo to AlCapone
Use port instead of passv. BTW, if both you and server are behind firewall/router/proxy/etc which you don't control then just forget about mirrowing.
__________________
And you know I mean that.

Reply With Quote
  #3  
Old October 9th, 2002, 06:08 AM
TheRealRodzilla TheRealRodzilla is offline
PHP Geek
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Posts: 37 TheRealRodzilla User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 sec
Reputation Power: 7
Send a message via ICQ to TheRealRodzilla
port?

Reply With Quote
  #4  
Old October 9th, 2002, 07:40 PM
AlCapone's Avatar
AlCapone AlCapone is offline
Mobbing Gangster
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Sep 2001
Location: "Best City" 2002 and 2003- Melbourne, Australia
Posts: 4,913 AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 h 36 m 31 sec
Reputation Power: 18
Send a message via ICQ to AlCapone Send a message via AIM to AlCapone Send a message via Yahoo to AlCapone
port activates active connection rather then passive. Before you do that, connect to non working server and see which connection it uses - active or passive (just ls and see what it says)

Reply With Quote
  #5  
Old October 9th, 2002, 10:23 PM
TheRealRodzilla TheRealRodzilla is offline
PHP Geek
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Posts: 37 TheRealRodzilla User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 sec
Reputation Power: 7
Send a message via ICQ to TheRealRodzilla
What's port? I didn't see it listed as a function...

Something a bit odd...from the working server:

COMMAND:> list
425 Can't build data connection: Connection refused.

For the non-working server:

COMMAND:> list
550 Cannot connect to XXX.XXX.XXX.XXX:4557 - Address already in use.

Reply With Quote
  #6  
Old October 10th, 2002, 03:06 AM
AlCapone's Avatar
AlCapone AlCapone is offline
Mobbing Gangster
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Sep 2001
Location: "Best City" 2002 and 2003- Melbourne, Australia
Posts: 4,913 AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 h 36 m 31 sec
Reputation Power: 18
Send a message via ICQ to AlCapone Send a message via AIM to AlCapone Send a message via Yahoo to AlCapone
'port' is not a function - it is way of connection (active that is) and is turned on/off with ftp_pasv() (sort of, depends from which side are you looking at it)

About your errors. You're on nt4 or win2k, right? I could describe problem in more deatails, but in summary: CLI FTP client shipped with them does not support passive connections - you can get around it but rather just get another client.

2 questions. What are you running as ftp servers and do you have firewalls/routers on either end?

Reply With Quote
  #7  
Old October 10th, 2002, 05:57 AM
TheRealRodzilla TheRealRodzilla is offline
PHP Geek
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Posts: 37 TheRealRodzilla User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 sec
Reputation Power: 7
Send a message via ICQ to TheRealRodzilla
I'm not sure about firewalls/routers. The one that works is ftp.filefront.com and the one that doesn't is ftp.edome.net

Reply With Quote
  #8  
Old October 10th, 2002, 06:08 AM
AlCapone's Avatar
AlCapone AlCapone is offline
Mobbing Gangster
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Sep 2001
Location: "Best City" 2002 and 2003- Melbourne, Australia
Posts: 4,913 AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 h 36 m 31 sec
Reputation Power: 18
Send a message via ICQ to AlCapone Send a message via AIM to AlCapone Send a message via Yahoo to AlCapone
ftp.edome.net is working fine for both active and passive, can't check ftp.filefront.com as anonymous access is not allowed there.

You don't run those servers, right? What os are you connecting from? As I mentioned nt4 and win2k might have problems with default ftp client.

Reply With Quote
  #9  
Old October 10th, 2002, 03:47 PM
TheRealRodzilla TheRealRodzilla is offline
PHP Geek
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Posts: 37 TheRealRodzilla User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 sec
Reputation Power: 7
Send a message via ICQ to TheRealRodzilla
I'm connecting to them through CuteFTP on Windows 2000. My server is running Linux. And no, I don't run those

Reply With Quote
  #10  
Old October 10th, 2002, 07:02 PM
AlCapone's Avatar
AlCapone AlCapone is offline
Mobbing Gangster
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Sep 2001
Location: "Best City" 2002 and 2003- Melbourne, Australia
Posts: 4,913 AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 h 36 m 31 sec
Reputation Power: 18
Send a message via ICQ to AlCapone Send a message via AIM to AlCapone Send a message via Yahoo to AlCapone
This is actually php forum, y'know Is it still not working? May be max # of simultaneous users caused the problem... don't know and can't check as don't have login to filefront. Try using different client on different os, I'm 99% sure this isn't php's fault.

Reply With Quote
  #11  
Old October 10th, 2002, 07:37 PM
TheRealRodzilla TheRealRodzilla is offline
PHP Geek
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Posts: 37 TheRealRodzilla User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 sec
Reputation Power: 7
Send a message via ICQ to TheRealRodzilla
I know this is a PHP forum. I posted what I'm using to connect on the server intself in the first post. I'm a little unclear on what you're saying.

FileFront works, both locally and on the server via PHP. eDome doesn't work locally, which doesn't matter as much as the fact that it causes infinite warnings on the webserver. You mentioned something about port...I already mentioned that I'm using ftp_pasv($conn, false) before connecting to the server. An overview:

-I connect
-Turn off passive connections
-Request a raw directory listing
--FileFront works perfectly
--eDome does not work. The odd thing is the script does what it's supposed to, but it spits out an infinite amount of errors and runs until manually halted.

Reply With Quote
  #12  
Old October 11th, 2002, 03:28 AM
AlCapone's Avatar
AlCapone AlCapone is offline
Mobbing Gangster
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Sep 2001
Location: "Best City" 2002 and 2003- Melbourne, Australia
Posts: 4,913 AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 h 36 m 31 sec
Reputation Power: 18
Send a message via ICQ to AlCapone Send a message via AIM to AlCapone Send a message via Yahoo to AlCapone
Ok, I can't say what's the error without seeing and trying the code. My best guess was active/passive connections, but that didn't work out too well, so I can't be much of further help.

Just supress errors with @ if you don't like them (who does?), not going to solve the problem but makes it look better. Although you have to do something about infinite execution...

Reply With Quote
  #13  
Old October 11th, 2002, 02:50 PM
TheRealRodzilla TheRealRodzilla is offline
PHP Geek
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Posts: 37 TheRealRodzilla User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 sec
Reputation Power: 7
Send a message via ICQ to TheRealRodzilla
I showed you the code in the first post....

PHP Code:
 $rlist ftp_rawlist($conn$dirname);
    while(
$dir next($rlist))
    { 

Reply With Quote
  #14  
Old October 12th, 2002, 11:36 PM
TheRealRodzilla TheRealRodzilla is offline
PHP Geek
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Posts: 37 TheRealRodzilla User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 sec
Reputation Power: 7
Send a message via ICQ to TheRealRodzilla
Nevermind...figured it out. Apparently ftp_rawlist() isn't standardized, so they were returning a different amount of information.

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationFTP Help > Trouble with Passive Connections and FTP Raw Lists


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread