Setting FTP to passive mode by default in php.ini

After changing the server, it seems that all PHP scripts that use FTP need to be changed as follows:

$conn = ftp_connect("host.com");    
ftp_login($conn,"user", "pass");     

//must add this:
ftp_pasv($conn, true);

      

Is there an easy way to reproduce this call on ftp_pasv

via php.ini

(or some other config file).

It would be easier than changing every script.

+3


source to share


1 answer


No, it cannot be changed. The initially passive mode is unconditionally disabled. In other words, FTP always uses active mode.

Check out the ftp.c

file
in the PHP repository.



In the parameter value field . ftpbuf.pasv

ftp_pasv

This has been the case since PHP 4 added support for passive mode. Cancel the functionftp_connect

to call ftp_pasv

.

Undo the server change, which is probably due to the active FTP mode ports being closed in the server firewall.
+2


source







All Articles