Page 1 of 1

ftp_put ascii mode under windows

Posted: Sun Apr 10, 2005 9:30 pm
by banach
Hi everyone!

My development environment is WinXP with EasyPHP. I develop and test my scripts and then upload them to my production sites. But because I have several sites using the same scripts on different servers, I have written a script which automates the process using the ftp_put function.

Everything works fine with one irritating caveat: when I upload a text file (using the DOS cr/lf end of line) in ascii mode, the result on the server has the same cr/lf end of lines (whereas with a standard FTP client, it would be automatically changed to lf).

For most files, this is no problem. But I have configuration files and flat database which expect the right Unix end of line. An obvious workaround is to change the local file's end of line before sending it in binary mode, which works fine. But that's kind of crazy given the fact that there is an ascii mode in PHP after all. So why the heck isn't it working?

Has anyone got any ideas - Thanks in advance.