Req #68462 [Opn]: ftp-put: debugging fail after "PORT command successful"

From: Date: Thu, 20 Nov 2014 14:45:39 +0000
Subject: Req #68462 [Opn]: ftp-put: debugging fail after "PORT command successful"
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188714@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68462&edit=1

 ID:                 68462
 User updated by:    stratflow at hotmail dot com
 Reported by:        stratflow at hotmail dot com
 Summary:            ftp-put: debugging fail after "PORT command
                     successful"
 Status:             Open
 Type:               Feature/Change Request
 Package:            FTP related
 Operating System:    FreeBSD 9.2-RELEASE-p10
 PHP Version:        5.4.35
 Block user comment: N
 Private report:     N

 New Comment:

Further digging lead to a patch that was never accepted and might address a component of this issue:

https://bugs.php.net/bug.php?id=55651
[http://www.elitehosts.com/blog/php-ftp-passive-ftp-server-behind-nat-nightmare/]


Previous Comments:
------------------------------------------------------------------------
[2014-11-20 13:41:42] stratflow at hotmail dot com

In addition, the following, ambiguious warnings might get issued:

Warning: ftp_put() [function.ftp-put.php]: php_connect_nonb() failed: Operation now in progress (36)
in xxxxx.php on line xxx

Warning: ftp_put() [function.ftp-put.php]: Type set to I in xxxxx.php on line xxx

------------------------------------------------------------------------
[2014-11-20 13:26:22] stratflow at hotmail dot com

Description:
------------
ftp_put() in some cases returns FALSE after transfer of a file.
The last logged error in $php_errormsg is 
  "ftp_put() [function.ftp-put.php]: PORT command successful"

It is unclear if this is a problem within PHP:FTP, a clientside filesystem problem or a serverside
problem.

The same script runs 100 transfers every 15 mins from one server off to different platforms of
different flavours. We have recently encountered a HUGE increase of these errors which would
indicate a problem in the source system.

As far as we can see, there is no (documented?) way to debug this problems and look into the server
responses. There was one proposal how to solve something like this in
  https://bugs.php.net/bug.php?id=44059
but that never made it into the tree.






Test script:
---------------

$ftp         = ftp_connect($ftphost,21,15);
$ftp_login   = ftp_login($ftp, $ftpuser, $ftppass);
$ftp_pasv    = ftp_pasv($ftp, true);

$ftp_up      = ftp_put($ftp, $trgfile, $srcfile, FTP_BINARY); 

# now check upload status:
if (!$ftp_up) { 
  print "upload check failed [" . $php_errormsg . "]<";
} else {
  print "upload successful";
}




Expected result:
----------------
Access to some sort of log of last server messages.



Note: 
The last erromessage in php_errormsg is might be misleading.

Note 2:
Unless you're transferring to a server to which you have ftp-logfile access, it's
impossible to debug this from the serverside.



Actual result:
--------------
ftp_put() returns FALSE for undebuggable reason.

Misleading or unclear messages in $php_errormsg


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=68462&edit=1


Thread (6 messages)

« previous php.bugs (#188714) next »