Not sure if anyone here will be able to shed some light on this but Google isn't helping.
I have some PHP code that opens a connection to an FTP server (running Pure-FTPd), writes a few lines to a file, then closes the connection. In other words: $fh = fopen('ftp://user:pass@ftp.example.com/test.csv','w'); for ($i=0;$i<=100;$i++) fputs($fh, "blah blah blah\r\n"); fclose($fh);
The problem is that when I look at the uploaded file it's contents have been truncated. Putting a suitably long sleep() before the fclose "solves" this for some definition of "suitably long" but obviously isn't a real solution. Inserting an fflush($fh) makes no difference.
I'm not sure if this is a PHP issue (specifically with the FTP wrappers to fopen/fclose), or a generic FTP issue, or a problem specific to Pure-FTPd. I have however tried to two different servers running very different versions of Pure-FTPd with the same effects.
If there was a standard issue here I'd have found something with Google, surely? Otherwise I don't know where to go looking?
On 04/08/11 10:53, Mark Rogers wrote:
I'm not sure if this is a PHP issue (specifically with the FTP wrappers to fopen/fclose), or a generic FTP issue, or a problem specific to Pure-FTPd. I have however tried to two different servers running very different versions of Pure-FTPd with the same effects.
The clue seems to be PHP version; my server is on Ubuntu 8.04, which means PHP 5.2.6.
Upgrading to 5.3 using the dotdeb repos seems to have fixed this (and broke loads of other things.... oops!)
Still seems slightly odd that I can't find any references on Google to this, but if anyone else goes looking there's this one for them to find now :-)
(Why still have an 8.04 server? Well if it helps, the whole point of the PHP script was to export data to a newer server....)
Mark Rogers wrote:
Still seems slightly odd that I can't find any references on Google to this, but if anyone else goes looking there's this one for them to find now :-)
Try using Ixquick - http://www.ixquick.com/do/metasearch.pl
I prefer it to Google.