Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question
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 Sep 4 '10 at 17:18
add comment

2 Answers

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!

share|improve this answer
    
Thanks for answer. See this is my current setting shup.com/Shup/412439/11084202023-My-Desktop.png –  metal-gear-solid Sep 4 '10 at 14:51
    
What should i change in my current setting? What is the difference between "Force UTF-8 and "Use custom charset"? –  metal-gear-solid Sep 4 '10 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! –  Bowe Frankema Sep 4 '10 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. –  metal-gear-solid Sep 4 '10 at 16:40
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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