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

From: Date: Mon, 04 Apr 2005 19:14:04 +0000
Subject: #30516 [Opn->Bgs]: file_put_contents doesnt work with FTP
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-76322@lists.php.net to get a copy of this message
ID: 30516 Updated by: sniper@php.net Reported By: nlopess@php.net -Status: Open +Status: Bogus Bug Type: FTP related Operating System: all PHP Version: 5.0.4 New Comment: That's a problem with the FTP server NOT PHP.. Previous Comments: ------------------------------------------------------------------------ [2005-04-01 19:59:01] nlopess@php.net 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 .. ------------------------------------------------------------------------ [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 (#76322) next »