#30516 [NoF->Opn]: file_put_contents doesnt work with FTP

From: Date: Fri, 01 Apr 2005 17:59:04 +0000
Subject: #30516 [NoF->Opn]: file_put_contents doesnt work with FTP
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-76830@lists.php.net to get a copy of this message
ID: 30516 Updated by: nlopess@php.net Reported By: nlopess@php.net -Status: No Feedback +Status: Open Bug Type: FTP related -Operating System: linux +Operating System: all -PHP Version: 5CVS-2004-10-21 (dev) +PHP Version: 5.0.4 New Comment: I've run a strace in the example script and it seems that the server I'm using is very picky. The problem is that PHP logins using multiple packets, and the server isn't expeting that. Output: # strace -e network ./php test.php socket(PF_INET6, SOCK_DGRAM, IPPROTO_IP) = 4 socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 4 connect(4, {sa_family=AF_INET, sin_port=htons(21), sin_addr=inet_addr("10.1.1.54")}, 16) = -1 EINPROGRESS (Operation now in progress) getsockopt(4, SOL_SOCKET, SO_ERROR, [0], [4]) = 0 recv(4, "220 AIBO FTP Server ready\r\n", 8192, 0) = 27 send(4, "USER ", 5, 0) = 5 send(4, "guest", 5, 0) = 5 send(4, "\r\n", 2, 0) = 2 recv(4, "500 \'GUEST \': command not unders"..., 8192, 0) = 39 Warning:: failed to open stream: Operation now in progress in .. Previous Comments: ------------------------------------------------------------------------ [2005-03-20 18:05:02] sniper@php.net No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you. ------------------------------------------------------------------------ [2005-03-07 22:23:17] sniper@php.net Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip ..and again, update the version field accordinly. ------------------------------------------------------------------------ [2004-10-21 19:17:21] nlopess@php.net Description: ------------ file_put_contents isn't working with FTP (or I'm doing something wrong). Tested in PHP 5.0.3-dev Reproduce code: --------------- <?php $context = stream_context_create(array('ftp' => array('overwrite' => true))); if(file_put_contents("ftp://anonymous:anonymous@10.1.1.54/MS/OPEN-R/MW/OBJS/SOCROB4L.BIN", file_get_contents('src/SocRob4l.bin'), null, $context) === false) { echo "There was an error"; } else { echo "The upload completed succesfully"; } ?> Expected result: ---------------- The upload completed succesfully Actual result: -------------- Warning: file_put_contents(ftp://...@10.1.1.54/MS/OPEN-R/MW/OBJS/SOCROB4L.BIN): failed to open stream: Operation now in progress in /home/socrob4l/consola/update4.php on line 5 There was an error ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=30516&edit=1

« previous php.bugs (#76830) next »