Hello.
When i open a file in my linux localhost with the command "gedit file.php" and then put a part of code in it, then i can't save the file. the save icon above the gedit is deactivated.
What can i do?

The file is probably not yours, or has wrong permissions. Open a terminal and type ls -l file.php to see the permissions. Post the result here.

Waht do you mean by the file is probably not mine?!
I typed that and the result:
-rw-r--r-- 1 root root

I found the solution myself. Thank you.

Hi Niloofar24,

Greetings !!!

As per the permissions to the file (i.e -rw-r--r-- 1 root root). This file is actually own by root user (see at last line "root root") which is a administrator user in linux who has permission to read and write on file (see first characters i.e."-rw") and other that "root" user all users have read permission only (i.e."-r--r--").

As you said you are unable to save he file, this is because you are not owner of that file and you cannot do any changes in file. For making changes into file you need to have same permission which root user has. Ask you system admin to assign permission of read and write to you.

Hope my answer was more clear to you and you will not take it as offending.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.