I use the free FTP software FileZilla. In most cases, whenever I open any PHP file from FTP using FileZilla, I get this error after editing then saving the file:

Parse error: syntax error, unexpected T_VARIABLE in File path here on line 1

How do I solve this error and get rid of this problem forever?

Should I switch to another FTP program?

  • 1
    Which Editor are you using in that operation? The editor might just be the cause so switching FTP client might not help at all. But anyway, you should try WinSCP.
    – hakre
    Commented Sep 4, 2010 at 17:18

2 Answers 2


It could be a problem with your file encoding. Make sure that your files are encoded in the same way as your wordpress install. In most cases your site use files encoded in UTF-8.

Go to FileZilla options: Open Site Manager > Charset tab - Custom Encoding > and see if it's UTF-8.

When it's set properly try to open and edit a file and see if it works!

  • Thanks for answer. See this is my current setting shup.com/Shup/412439/11084202023-My-Desktop.png Commented Sep 4, 2010 at 14:51
  • What should i change in my current setting? What is the difference between "Force UTF-8 and "Use custom charset"? Commented Sep 4, 2010 at 15:40
  • 1
    I would go force UTF-8 so you know for certain the right encoding is used. If not you'll get weird characters added to your file which might give the PHP errors! Commented Sep 4, 2010 at 16:34
  • +1 Ok Thanks I will set it to "Force UTF-8". But just curious why "auto detect" is not good. What is the means "use UTF-8 if server supports" it? and why this option create problem with PHP files. Commented Sep 4, 2010 at 16:40

Another file encoding option could be file format related. If your edit through FileZilla saves the file in Windows format and the server is Linux for example.

In such case editing might remove newlines, which means that some code lines might get concatenated to a single comment line and therefore commented.

Obviously from your error this is not the issue, just for the sake of documentation - one should look into that as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.