this question has answer here:
- php parse/syntax errors; , how solve them? 12 answers
i downloaded php files through ftp. after editing them , uploading them again, error on line 1
1 of first actions:
parse error: syntax error, unexpected '{' in "...etc.
the weird thing is, work correctly on local host. display fine when open them in ide
(jetbrains phpstorm). however, if open files (from local host) in example notepad, complete file on 1 line.
edit: since question marked duplicate, think need emphasise this: there nothing wrong code itself. works on local host. know unexpected '{' means. error entered above example. if first line include(), unexpected include etc. if copy paste exact code new file, error gone.
i did find out how fix 1 file. if copy code in phpstorm, create new file , paste in there, works. however, there around 500 files, doing manually take lot of time. questions are:
- what causes kind of behaviour , how can prevent in future.
- how can fix current project.
check type of end-of-line / newline character being inserted ide.
i had similar problem notepad++, , setting change was: edit >> eol conversion >> (and in case has set windows format)
Comments
Post a Comment