Jump to content

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


Recommended Posts

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?

If you told us what the errors were, someone could probably give you an answer without playing a game of twenty guesses.

 

If the errors are header related, it is probably because the file got saved as UTF-8 encoding with BOM (Byte Order Mark) characters at the start of the file.

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.

So, have you examined the file on the server to make sure what is in it and/or download it after saving your original file that is on your computer now (just in case the file on the server is incomplete and corrupted.)

So, have you examined the file on the server to make sure what is in it and/or download it after saving your original file that is on your computer now (just in case the file on the server is incomplete and corrupted.)

 

the file on the server was complete, and it worked fine

 

i also have a backup of it

 

the problem is that when i save it in notepad2, the filesize shrinks, and it no longer works...

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:

 

<?php

require("head.php");

require("includes/security.php");

?>

I did not ask what the code was before when it worked or even what it is on your computer. I asked what it actually is after you uploaded to your web server.

 

How are you uploading it and are you uploading in binary mode or ASCII mode?

 

Where are you observing the file size difference occurring? At what two points and where is the file when you are you looking at the starting and ending size? This is probably just due to spaces/tab characters.

 

You are going to need to attach or post the file before and the file after for anyone in a forum to be able to help you with it.

i think i know whats wrong

 

when i save it in notepad2 and upload it, the file goes from this:

 

<?php

require("head.php");

require("includes/security.php");

?>

 

to this:

 

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

 

i think its because its transfering it in binary

how do i stop this from happening?

there should be a setting that you change in your ftp app.  what program are you using to upload the files?

 

im using CUTEFTP, and its saying that its "TYPE is now ASCII" before it uploads the file, so its screwing up the file even in ASCII mode.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.