I downloaded php files through ftp. After editing them and uploading them again, I basically always get an error on line 1
with one of my first actions:
Parse error: syntax error, unexpected '{' in "...etc.
The weird thing is, they work correctly on my local host. They also display fine when I open them in my IDE
(jetBrains phpStorm). However, if I open my files (from local host) in for example Notepad, the complete file is on one line.
Edit: Since my question was marked as a duplicate, i think i need to emphasise this: There is nothing wrong with the code itself. It works perfectly on my local host. I know what unexpected '{' means. The error i entered above is just an example. If the first line was an include(), i would get unexpected include etc. If i copy paste the exact code into a new file, the error is gone.
I did find out how to fix it for one file. If I simply copy the code in phpStorm, create a new file and paste it in there, it works. However, there are around 500 files, so doing this manually would take a lot of time. So my questions are:
- What causes this kind of behaviour and how can i prevent this in the future.
- How can i fix this for my current project.