ftp_put ascii mode under windows

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
banach
Forum Newbie
Posts: 1
Joined: Sun Apr 10, 2005 9:18 pm
Location: Britain - London

ftp_put ascii mode under windows

Post 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.
Post Reply