read-only php.ini file is preventing saving new configuration
Asked Answered
N

3

7

I've installed "PHP PECL EXTENSION/MODULE ON UBUNTU". At the end, I was asked to add some configuration lines in the a file called php_ini that can be found in this path:

/etc/php5/apache2/php.ini

However, after making my changes, I can't save the file because the file is read-only.

What the appropriate action to save my changes. I don't really why the file is read-only, I don't know if there is some thing I need to do. I'm new in Ubuntu/php

Thanks for helping.

Nobe answered 15/9, 2014 at 16:36 Comment(3)
Use sudo to edit system files.Ragan
sudo vim /etc/php5/apache2/php.iniKeynes
@Ragan You should add this as an answer(possibly with a small explanation or mention to gksudo if he's planning on using a gui editor like gedit or knote), you're correct.Drexler
M
5

For accessing the system files you need root permission.So you would need to use sudo command.it would be like sudo vim /etc/php5/apache2/php.ini(if u are using vim editor) as user2075215 mentioned in comment.

Martel answered 15/9, 2014 at 16:45 Comment(2)
I've tried the command, but I'm getting the error that there's not such command as vim. I'guess I must be missing vim. However I've got gedit. Isit still fine? Maybe I must get vim if I'll be using that often down the road.Nobe
You could try nano. I believe that is installed on Ubuntu systems by default. So... sudo nano /etc/php5/apache2/php.iniBarnabe
D
2

Use command: "sudo gedit /etc/php5/apache2/php.ini"
It will open text editor, change your settings and save with ctrl+s and close the editor.
All changes will be saved.

Dilan answered 20/10, 2016 at 6:0 Comment(0)
J
2

Since I am a beginner in Terminal, I used cd multiple times to get to the location of my php.ini file. cd etc cd php cd 7.0 . . .

Then I did

$ sudo xdg-open php.ini

and the file popped up and I am able save edits now.

Jacquline answered 24/5, 2018 at 14:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.