Php.ini not changing and says permission denied

Clemy

Member
Mar 23, 2012
12
0
51
cPanel Access Level
Root Administrator
Hi,

I am new to the putty, but i find my way around via the internet and this forum... thanks,

but for some reason my php.ini does not want to change, it gives a permission denied error when i use /usr/local/lib/php.ini

how can i fix this?

Its a VPS which has one website on it..

website uses wordpress
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
Are you logged in as the root user to SSH when trying to edit /usr/local/lib/php.ini file?

Next, what does the following show when you run this command?

Code:
lsattr /usr/local/lib/php.ini
 

Clemy

Member
Mar 23, 2012
12
0
51
cPanel Access Level
Root Administrator
hi thank you so much for your reply

i am logged in as root, on the IP of my VPS and not the IP of website IP, via SSH

this is what i get when i run that code...


Code:
------------- /usr/local/lib/php.ini
 
Last edited:

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
What are you using to try to edit the file? Can you post the series of commands with the full text in command line that you are getting upon trying to edit the file? If you are simply doing:

Code:
/usr/local/lib/php.ini
That isn't a valid command, and it would return a permission denied error:

Code:
#/usr/local/lib/php.ini
-bash: /usr/local/lib/php.ini: Permission denied
This would be because the command to open it to write isn't being passed, since the user wouldn't have told the shell prompt what to do for that file. You'd have to use either vi or nano to open the file:

Code:
vi /usr/local/lib/php.ini
I am pretty sure you didn't pass the command to open it to write given the error you are indicating.
 

Clemy

Member
Mar 23, 2012
12
0
51
cPanel Access Level
Root Administrator
I did everything as you said in your last post and you are 100% correct,

i used vi /usr/local/lib/php.ini

and it brought up the file.. should i press "i" to edit it and insert my code?
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
You would need to do i or esc + i in order to insert text, then esc + :wq to write to the file.
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
I cannot agree here. First of all, vi is a better editor with more options and less likely to allow destroying the file easily (it won't corrupt line ends and it will not allow two people to open the same file without a warning). It would be better to learn vi at the beginning. Experienced system administrators use vi rather than pico or nano typically, and if you are going to learn to use an editor, you might as well spend the few extra moments to learn vi over those other editors. Most people who learn pico or nano never switch to learning vi or have trouble learning vi, putting themselves at a disadvantage.