scarhand Posted December 4, 2008 Share Posted December 4, 2008 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? Quote Link to comment https://forums.phpfreaks.com/topic/135579-solved-errors-after-opening-a-php-file-and-saving-it-in-notepad2-without-changes/ Share on other sites More sharing options...
PFMaBiSmAd Posted December 4, 2008 Share Posted December 4, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/135579-solved-errors-after-opening-a-php-file-and-saving-it-in-notepad2-without-changes/#findComment-706316 Share on other sites More sharing options...
scarhand Posted December 4, 2008 Author Share Posted December 4, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/135579-solved-errors-after-opening-a-php-file-and-saving-it-in-notepad2-without-changes/#findComment-706317 Share on other sites More sharing options...
PFMaBiSmAd Posted December 4, 2008 Share Posted December 4, 2008 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.) Quote Link to comment https://forums.phpfreaks.com/topic/135579-solved-errors-after-opening-a-php-file-and-saving-it-in-notepad2-without-changes/#findComment-706321 Share on other sites More sharing options...
scarhand Posted December 4, 2008 Author Share Posted December 4, 2008 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... Quote Link to comment https://forums.phpfreaks.com/topic/135579-solved-errors-after-opening-a-php-file-and-saving-it-in-notepad2-without-changes/#findComment-706328 Share on other sites More sharing options...
scarhand Posted December 4, 2008 Author Share Posted December 4, 2008 even if i put "die('test');" at the very top of the script it doesnt even show "test" in the page, it still shows the same error Quote Link to comment https://forums.phpfreaks.com/topic/135579-solved-errors-after-opening-a-php-file-and-saving-it-in-notepad2-without-changes/#findComment-706349 Share on other sites More sharing options...
scarhand Posted December 5, 2008 Author Share Posted December 5, 2008 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"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/135579-solved-errors-after-opening-a-php-file-and-saving-it-in-notepad2-without-changes/#findComment-706352 Share on other sites More sharing options...
PFMaBiSmAd Posted December 5, 2008 Share Posted December 5, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/135579-solved-errors-after-opening-a-php-file-and-saving-it-in-notepad2-without-changes/#findComment-706360 Share on other sites More sharing options...
scarhand Posted December 5, 2008 Author Share Posted December 5, 2008 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? Quote Link to comment https://forums.phpfreaks.com/topic/135579-solved-errors-after-opening-a-php-file-and-saving-it-in-notepad2-without-changes/#findComment-706368 Share on other sites More sharing options...
ardyandkari Posted December 5, 2008 Share Posted December 5, 2008 there should be a setting that you change in your ftp app. what program are you using to upload the files? Quote Link to comment https://forums.phpfreaks.com/topic/135579-solved-errors-after-opening-a-php-file-and-saving-it-in-notepad2-without-changes/#findComment-706372 Share on other sites More sharing options...
scarhand Posted December 5, 2008 Author Share Posted December 5, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/135579-solved-errors-after-opening-a-php-file-and-saving-it-in-notepad2-without-changes/#findComment-706377 Share on other sites More sharing options...
scarhand Posted December 5, 2008 Author Share Posted December 5, 2008 is notepad2 reformatting the file when i save it so that the entire file content is all on line 1?? Quote Link to comment https://forums.phpfreaks.com/topic/135579-solved-errors-after-opening-a-php-file-and-saving-it-in-notepad2-without-changes/#findComment-706385 Share on other sites More sharing options...
scarhand Posted December 5, 2008 Author Share Posted December 5, 2008 this is so frustrating this is the 3rd time this week this has happened ive already had to rewrite 2 php files just to get them to work Quote Link to comment https://forums.phpfreaks.com/topic/135579-solved-errors-after-opening-a-php-file-and-saving-it-in-notepad2-without-changes/#findComment-706391 Share on other sites More sharing options...
scarhand Posted December 5, 2008 Author Share Posted December 5, 2008 ok i got it to work by making a new PHP file, and copy and pasting the entire contents into it, then saving, then uploading Quote Link to comment https://forums.phpfreaks.com/topic/135579-solved-errors-after-opening-a-php-file-and-saving-it-in-notepad2-without-changes/#findComment-706392 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.