downloads | documentation | faq | getting help | mailing lists | reporting bugs | sites | links | my 
search for in the  
view the version of this page
Last updated: Thu, 21 Aug 2003


(PHP 3>= 3.0.13, PHP 4 )

ftp_pasv -- Turns passive mode on or off


bool ftp_pasv ( resource ftp_stream, bool pasv)

ftp_pasv() turns on passive mode if the pasv parameter is TRUE. It turns off passive mode if pasv is FALSE. In passive mode, data connections are initiated by the client, rather than by the server.

Returns TRUE on success or FALSE on failure.

add a note add a note User Contributed Notes
dwales at easyetrader dot com
11-Jan-2003 02:02
When using the ftp_puts or ftp_fputs, if you are receiving the error: ftp_put(): Illegal PORT command.
Here is the fix, use


I couldn't find any help on this so had to work it out for myself, so here it is for the rest of you guys :)
I guess PHP sets passive mode FALSE by default, you will only need to issue this command if the FTP server you are connecting requires you to do so, try it and see.
taomyn at hotmail dot com
16-Nov-2002 12:06
It's not too well documented here or too many other places, but the ftp_pasv function has to come after the ftp_login function, otherwise it doesn't work.

For example:

$connection = @ftp_connect($server, $port);
$loggedOn = @ftp_login($connection, $user, $password);
$mode= @ftp_pasv($connection, 1);
$systype = @ftp_systype($connection);
ybourbeau at edison dot ca
09-Apr-2002 05:28
Directly from bsd FTP manual pages:

The PASV command requests that the remote server open a port for the data connection and return the address of that port.  The remote server listens on that port and the client connects to it.

                 When using the more traditional PORT command, the client listens on a port and sends that address to the remote server, who connects back to it.  Passive mode is useful when using ftp through a gateway router or host that controls the directionality of traffic.  (Note that though ftp servers are required to support the PASV command by RFC 1123, some do not.)
04-Apr-2002 07:19
PASV: For ftp users behind firewall, the server LISTEN for a connection.

Non-PASV: The client LISTEN for a connection from server.

 Last updated: Thu, 21 Aug 2003
show source | credits | sitemap | mirror sites 
Copyright © 2001-2003 The PHP Group
All rights reserved.
This mirror generously provided by:
Last updated: Sat 01 Nov 2003 04:13:36 EST EST