The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Php.ini not changing and says permission denied

Discussion in 'General Discussion' started by Clemy, Mar 30, 2012.

  1. Clemy

    Clemy Member

    Joined:
    Mar 23, 2012
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    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
     
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    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
     
  3. Clemy

    Clemy Member

    Joined:
    Mar 23, 2012
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    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
     
    #3 Clemy, Mar 30, 2012
    Last edited: Mar 30, 2012
  4. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    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.
     
  5. Clemy

    Clemy Member

    Joined:
    Mar 23, 2012
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    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?
     
  6. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    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.
     
  7. linux7802

    linux7802 Well-Known Member

    Joined:
    Dec 14, 2007
    Messages:
    232
    Likes Received:
    1
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Hello Clemy,

    As you are newbie in the putty therefore I would like to recommend you please use the simple text editor like pico or nano as its much easier as compare to the vi text editor, it will save your time to work in the putty.
     
  8. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    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.
     
Loading...

Share This Page