Reputation: 95
Why are PHP files I am uploading via FTP losing their formatting?
I create the files in notepad++ and upload via FileZilla to HostGator.
The file looks like this in notepad..
The file looks like this in vi on the server..
I've tried uploading the same file using Auto and Binary, neither worked.
All other files on the server that I did not create from scratch in notepad++ appear fine in vi. With that being said I've created many scripts from scratch in notepad++ and have never had this issue before.
--- edit ---
solution: change end of line to UNIX/OSX format in Notepad++
Upvotes: 1
Views: 111
Reputation: 98921
@arkascha explained well what's happening.
The solution is to change the file format to UNIX/OSX format
on notepad++
Upvotes: 0
Reputation: 42925
Different operating systems use different coding of linebreaks.
Namely MS-Windows uses "\r\n", whilst all unixoid systems (so also Linux) use "\n".
Nothing is "lost" during the transfer, but the code is interpreted different by the server side editor. There are settings in each editor to control that behavior.
Upvotes: 1