SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2008
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    errors after opening a php file and saving it in notepad2 (without changes)

    i download a php file off the server

    i open it in notepad2 and save the file (without making any changes)

    i then upload the file back to the server, and now the file contains errors, when it didnt before

    why is this happening?

    the error is "Parse error: syntax error, unexpected '{' in /home/site/public_html/register.php on line 1"

    there isnt even a { on line 1 of the file.

    i mean, i didn't even edit any code. i just opened the file and then saved it and closed it.

    the filesize also shrunk after i saved it.

    why would i get the error "Parse error: syntax error, unexpected '{' in /home/site/public_html/register.php on line 1"

    when the top of the code is this:

    Code:
    <?php
    
    require("head.php");
    
    require("includes/security.php");
    
    ?>

  2. #2
    Use The Cloud
    Join Date
    Jan 2006
    Location
    Boise, ID
    Posts
    556
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you able to replicate the problem multiple times?
    Brad Hanson, Web Applications & Scalability Specialist
    ► Is your website outgrowing its current hosting solution?
    ► PM me for a FREE scalability consult!
    ► USA Based: Available by Phone, Skype, AIM, and E-mail.

  3. #3
    SitePoint Evangelist
    Join Date
    Oct 2005
    Location
    Michigan, USA
    Posts
    434
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    It's the end of line characters. If you view the code on your server (in your ftp program or cPanel) you'll probably see it all on one line. Uploading in binary is one way around this. Changing the line ending format in your editor is another.
    - Robert


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •