When I try to upload a php file on my server I get a message: "Parse error: ..." I know what that means, but the problem is something else.
If I edit the file on my local server (I XAMPP installed on my computer) everything is fine.
But if I upload the same file online (Hosting at Godaddy) all code is displayed in one line. I have tested this by downloading it from server and then in Notepad++.
For example my code looks like this:
<?php
//my comment
echo 'First';
echo 'Second';
?>
But is displays:
<?php //my comment echo 'First'; echo 'Second';?>
So, now //my comment breaks all my code.
I can’t find a solution for this. Please help.
Use an editor like
Notepad++for editing your code.There are two possibilities. Godaddy server you are having is on
Windowsand you are on a Unix based system. And the Other way around.In short,
\r\nbreaks used in UNIX is not actually compatible with\nbreaks used in Windows. So use an editor like Notepad++ which has a preference to save with\r\nbreaks by default.Edit:
Try switching the transfer mode from Binary to ASCII as well in the FTP program you are using. Usually FTP softwares are supposed to cross support the text files on the host and client during the transfer.
Edit 2[ Thanks @Wesley Murch ]
For easy switching of EOL(End of Line) Format :
Edit -> EOL Convertion -> WindowsFormat