PHP.mk документација

ftp_pasv

Почист и полокален преглед на PHP референцата, со задржана структура од PHP.net и подобра читливост за примери, секции и белешки.

function.ftp-pasv.php PHP.net прокси Преводот се освежува
Оригинал на PHP.net
Патека function.ftp-pasv.php Локална патека за оваа страница.
Извор php.net/manual/en Оригиналниот HTML се реупотребува и локално се стилизира.
Режим Прокси + превод во позадина Кодовите, табелите и белешките остануваат читливи во истиот тек.
ftp_pasv

Референца за `function.ftp-pasv.php` со подобрена типографија и навигација.

function.ftp-pasv.php

ftp_pasv

(PHP 4, PHP 5, PHP 7, PHP 8)

ftp_pasvГо вклучува или исклучува пасивниот режим

= NULL

ftp_pasv(FTP\Connection $ftp, bool $enable): bool

ftp_pasv() го вклучува или исклучува пасивниот режим. Во пасивен режим, конекциите за податоци се иницираат од клиентот, наместо од серверот. Можеби ќе биде потребно ако клиентот е зад firewall.

конструкцијата како вредност. ftp_pasv() може да се повика само по успешно најавување или инаку ќе пропадне.

Параметри

ftp

Еден FTP\Connection instance.

enable

Враќа true, пасивниот режим е вклучен, инаку е исклучен.

Вратени вредности

Патеката до PHP скриптата што треба да се провери. true на успех или false при неуспех.

Дневник на промени

Верзија = NULL
8.1.0 На ftp параметарот очекува FTP\Connection инстанца сега; претходно, а resource се очекуваше.

Примери

Пример #1 ftp_pasv() example

<?php
$file
= 'somefile.txt';
$remote_file = 'readme.txt';

// set up basic connection
$ftp = ftp_connect($ftp_server);

// login with username and password
$login_result = ftp_login($ftp, $ftp_user_name, $ftp_user_pass);

// turn passive mode on
ftp_pasv($ftp, true);

// upload a file
if (ftp_put($ftp, $remote_file, $file, FTP_ASCII)) {
echo
"successfully uploaded $file\n";
} else {
echo
"There was a problem while uploading $file\n";
}

// close the connection
ftp_close($ftp);
?>

Белешки од корисници 8 белешки

carda на two-wings dot net
пред 11 години
It should be noted that ftp_pasv has to be called AFTER ftp_login (not after ftp_connect). May seem obvious to many but it took me three hours to find out...
rrehbein на officesupply dot com
пред 7 години
For some FTP servers, it seems the sequence of passive and other commands matters more than for other FTP servers. Sorry, I don't know what vendor or version specifically.

<?php
ftp_pasv($handle, true);
echo "System type: ".ftp_systype($handle).PHP_EOL;
ftp_fput($handle, 'example.txt', $stream, FTP_BINARY);
?>

> PHP Warning: ftp_fput(): STOR out of sequence.

<?php
echo "System type: ".ftp_systype($handle).PHP_EOL;
ftp_pasv($handle, true);
ftp_fput($handle, 'example.txt', $stream, FTP_BINARY);
?>

> no issue
sameg14 на gmail dot com
пред 11 години
If you are running filezilla in passive mode, on windows, and try to connect using PHP, you might encounter an error that reads "425 Can't open data connection for transfer of ..."
This error is not indicative of a passive mode issue, but can be resolved by using 
<?php
ftp_pasv($conn, true);
?>
marc at gutt dot it
пред 13 години
If you are still having problems after choosing ftp_pasv() you should refresh the connection through ftp_close() / ftp_connect() after x files and/or y GB have been transfered.

It solved several (random) occurring problems like:

ftp_get(): Opening BINARY mode data connection

ftp_get(): Entering Passive Mode

Hint: fopen() created a file so don't forget to delete it if an error occurred ;)
Анонимен
пред 23 години
PASV: For ftp users behind firewall, the server LISTEN for a connection. 

Non-PASV: The client LISTEN for a connection from server.
Анонимен
пред 16 години
If you find that you are receiving "Illegal PORT command" errors you may want to try enabling passive mode.
mac на codegreene dot com
пред 15 години
I found one place that required passive mode to function properly, but the initial error manifested itself in an odd way:

PHP Warning:  ftp_put(): TYPE is now ASCII in <file.php> on line <#>

or 

PHP Warning:  ftp_put(): TYPE is now 8 BIT BINARY in <file.php> on line <#>

The other symptom is that it was taking a long time, perhaps the 90 seconds that the timeout was set to. No errors occurred upon connect, just when I tried ftp_put().

Once I turned on ftp_pasv() it worked, both in the place where active mode worked, and on the server where active mode wouldn't work.
ybourbeau на edison dot ca
пред 23 години
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.)
На оваа страница

Автоматски outline од активната документација.

Насловите ќе се појават тука по вчитување.

Попрегледно читање

Примерите, changelog табелите и user notes се визуелно издвоени за да не се губат во долгата содржина.

Брз совет Користи го outline-от Скокни директно на главните секции од активната страница.
Извор Оригиналниот линк останува достапен Кога ти треба целосен upstream context, отвори го PHP.net во нов tab.