No, it’s OK, I can give you the answers to save the trauma I went through understanding it.
It’s generally considered best practise to set 755 on dirs.and 644 on files. Any dirs and files ICEcoder creates it does so with those permissions.
Generally speaking, if you start off with an empty wwwroot which has 755 and use your editor to create dirs and files within that containing 755 and 644 perms respectively, that’s good, plus they’ll be created under the same owner as your web server, likely www-data. All is well overall and you can happily modify these dirs and files with your editor, as they were not only created by the same user (www-data) that’s now trying to modify them plus the 755/644 perms are fine too.
The only trouble comes when you say bring in a file created by another source. Let’s say a file has 644 permissions again but an owner of ‘root’. That’s no good as we’re running under the www-data user and there’s not relaxed enough permissions either for it to overwrite, so you can’t do that. You now have 2 options - either change the owner of that file to www-data so you can write on it, or relax the write permissions enough to allow it to be writeable by the user that doesn’t have ownership of it (ie, allowing www-data to ignore who owns the file and overwrite it because the permissions are relaxed enough).
The 3 numbers in permissions relate to user, group and other (eg 644 means 6 on user, 4 on group and 4 on other). The numbers are made up via 4 = read, 2 = write, 1 = execute. Therefore 4 on one of those digits just means ‘read’. 5 can only possibly mean ‘read and execute’ (4+1). So really you’d need at least 6 in the ‘other’ section (to mean read and write, ie 4+2). So you’d to set 646 on your file at least if you don’t change owner instead, Most people go the whole hog and set 7 though (read+write+execute), ie 647. However, setting 7 on the other category is considered dangerours and it’s better to change the owner.
So to sum up - files not created by your web server under which PHP is running (ie, from an external source), will either need the owner changed or high enough permissions on the other part of permissions. Doing either of course can’t be done from PHP and so yes, you unfortunately need to do it from something with higher privileges, eg from your terminal under a user with high enough privileges.
This is exactly why when I bring in an external file to edit in ICEcoder and try to save, it informs me it can’t save. I have to then use my terminal to change owner or permissions to allow writeability to be possible.
Hope this crash course in file ownership/permissions/security helps you build your editor with CodeMirror. 