WordPress php error after editing file with FileZilla

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

Read More

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

Should I switch to another FTP program?

Related posts

Leave a Reply

2 comments

  1. 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!

  2. 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.