Support » Fixing WordPress » Saving and reloading any php files generates an error

  • I’m doing some work for a pal who wants me to change his website a bit. It uses wordpress and some php and css.
    When I download any php file via FTP, and save it (even if I have made no changes) then upload it again, when I open the relevant page I get this error:

    parse error syntax error unexpected t_string in on line 1

    This happens on every php file I download, save and upload. I can download, view, not save and upload and everything works well.

    I’m using NetBeans IDE to view the php, I’ve also tried just using notepad but I’m getting the same problem.

    The php files begin like this:

    * Template Name: Contact
    * This is the template that displays all pages by default.
    * Please note that this is the WordPress construct of pages
    * and that other ‘pages’ on your WordPress site will use a
    * different template.
    * @package WordPress
    * @subpackage Optus
    * @since Optus 1.0
    get_header(); ?>

    Can any of you experts help???


Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator kmessinger


    Wild stab . . .
    get_header( $name ); ?>

    Thanks for the response.

    Didn’t make any difference though. The problem is not any syntax in the php file (as far as I can tell). I can extract a file via ftp. A php file that works fine when hosted. Then I open it, make no changes whatsoever. Save it. FTP it back up to the host calling it the same thing. It’s completely unchanged (apart from the fact that I have saved it). And when I check the site out I get the parse error message (above).

    It’s like me saving it is somehow corrupting it??

    Like I said, I used netbeans but also notepad (to eliminate netbeans as the problem). Same problem with both.

    Moderator kmessinger


    Are you using binary or ascii?

    A little late to the party but I’ll post this just in case someone else runs into the same issue. This seems to be a line endings issue. Your live server, from which you downloaded the files, is most likely running Unix. Your local machine probably isn’t. The two OSs use different line endings

    As of Netbeans 7.3, there is a new change-line-endings-on-save plugin that allows you to configure line endings globally or on a per-project basis. Check it out here

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Saving and reloading any php files generates an error’ is closed to new replies.