I've seen this happen a few times and it's very frustrating when it happens especially if it's a large script. I find out about it when I visit the web page and there's an error on screen!
I opened the php file in noteplad++ and every bit of the coding is on 1 major long line!! Has anyone else had this happen and do you know what causes it to happen?
I have to spend hours now going through the one line, seperating each part onto its own lines again before the script will work.
Hoping for a solution, or atleast the comfort of knowing I'm not alone in this situation!
I've never heard of such a thing, I use Komodo-Edit for all my work, never had a problem can even customize the size of tabs, auto indent, highlight your own way etc.
I'm not blaming the editor at all, the particular web page was working fine not so long ago and I've been working on other pages since.
Just looked at the file within cpanel's file editor. The file editor forces the script to go down the page anyway but on the very first line is this....
I dont know the cause, but a solution would be to assign permissions to the folders with scripts that make them readonly so they can't be changed server side. Then you can give permissions to like you images/uploads/ folder (or whateva you need to be change via your scripts) Again not a reason for why it happened but something that can help prevent problems in the future.
It sounds like you might be switching between MS and *nix line ending style OSes. I for 1 never under any circumstance edit a file on a production server. It is best practice to edit the files in a development environment and only move tested code to a production environment.
The cpanel file editor seems like the prime suspect to me ... I don't see any difference between a file using windows and unix newlines on my installation. You can check w/ the "who all characters" button in notepad++, of course ...
The cpanel file editor seems like the prime suspect to me
Since I don't use the cPanel file editor, I can't see that being the cause for any changes. I mentioned cPanel's editor only because I used it to view the script after using notepad++'s built in ftp plugin to download the script for editing.
It makes more sense to suggest that something happened to the file during ftp transmission from the local machine to the server. But I can't accept that as I know that noteplad++ and fileziller ftp client are very commonly used in web development and yet this problem I have had tonight, I don't see others complaining of it and I've suffered with it on more than one occasion.
It is a rarity, but some of my scripts are 1000 lines of coding. The script in question this time was only around 200 lines but still a bulls ache having to fix it!
I think there are 2 many possible causes for me to narrow it down and so I am without faith that I will find the answer
Do you keep a local copy of your PHP files? Seems like if the error happened during transmission to the site (could it be the php file was uploaded in binary mode rather than ascii? I don't know if this would cause the problem), then you would still have your original local copy.
Most of my work and transferring is done via notepad++ which uses binary transfer mode as its default setting. It's only on the very odd occasion that I use filezilla since notepad++ has built in ftp. I have just checked the transfer mode setting in filezilla and it was set at auto so I've switched it to binary and hopefully (assuming that may have been the cause) I won't have anymore problems. Fingers crossed and touching wood!!
Bookmarks