note 109232 added to ftp.examples-basic
| From: | Anonymous | Date: | Thu, 28 Jun 2012 08:06:50 +0000 |
| Subject: | note 109232 added to ftp.examples-basic | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-188952@lists.php.net to get a copy of this message | ||
If you are having timeouts uploading a file, such as the following warning:
Warning: ftp_put() [function.ftp-put]: Could not open data connection to port XXXXX: Connection
timed out in /xxxx/xxxx/xxx.php on line XX
You might want to consider using ftp_pasv().
The error is likely due to firewall issue on the "FTP client side" when connnecting using
FTP active mode.
Switching to FTP passive mode often solves the problem.
Example:
<?php
// set up basic connection
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// turn ftp passive mode on
ftp_pasv($conn_id, true);
?>
----
Server IP: 123.204.228.176
Probable Submitter: 220.136.50.20
----
Manual Page -- http://www.php.net/manual/en/ftp.examples-basic.php
Edit -- https://master.php.net/note/edit/109232
Del: integrated -- https://master.php.net/note/delete/109232/integrated
Del: useless -- https://master.php.net/note/delete/109232/useless
Del: bad code -- https://master.php.net/note/delete/109232/bad+code
Del: spam -- https://master.php.net/note/delete/109232/spam
Del: non-english -- https://master.php.net/note/delete/109232/non-english
Del: in docs -- https://master.php.net/note/delete/109232/in+docs
Del: other reasons-- https://master.php.net/note/delete/109232
Reject -- https://master.php.net/note/reject/109232
Search -- https://master.php.net/manage/user-notes.php