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 problem

Discussion in 'General Discussion' started by bt4, Jan 13, 2011.

  1. bt4

    bt4 Well-Known Member

    Joined:
    Jul 1, 2010
    Messages:
    69
    Likes Received:
    0
    Trophy Points:
    6
    Code:
    chattr +i /etc/php.ini
    chattr +i /usr/lib/php.ini
    chattr +i /usr/local/lib/php.ini
    chattr +i /usr/local/cpanel/3rdparty/etc/php.ini
    chattr +i /usr/local/cpanel/3rdparty/lib/php.ini
    Hello,
    i have run this command on my server now i can not edit php.ini with root ,iget me this massge

    Error writing /usr/local/lib/php.ini: Permission denied ]
     
  2. cPanelJared

    cPanelJared Technical Analyst
    Staff Member

    Joined:
    Feb 25, 2010
    Messages:
    1,842
    Likes Received:
    18
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    This is happening because the operating system is doing what you told it to do. chattr +i applies the i, or immutable, attribute, to the target file. Immutable means that nothing can alter the file. No user can do anything to change the file, not even root, no matter what the file's permissions or ownerships are.

    To edit the php.ini files, first remove the i attribute. You can do this by running the same commands, except with "-i" instead of "+i" to remove the immutable attribute.

    The immutable attribute needs to be used very carefully and sparingly. In almost all cases on a cPanel server, if you think you need to apply the immutable attribute to a file to prevent it from being changed, there is a better way that does not involve changing the file's attributes. The immutable attribute can cause very severe problems, particularly when cPanel updates itself, because nothing can alter a file that has this attribute set.
     
  3. bt4

    bt4 Well-Known Member

    Joined:
    Jul 1, 2010
    Messages:
    69
    Likes Received:
    0
    Trophy Points:
    6
    thanks,

    how i can safe file php.ini ?
    i want for all hosts on my server read default php.ini
    i have change safe mod to ON
    but when my clients upload new php.ini from public_html safe mod changed to OFF
    i want disable it hosts be can not have access to change php.ini by upload new php.ini file

    i hope u understand
     
  4. cPanelJared

    cPanelJared Technical Analyst
    Staff Member

    Joined:
    Feb 25, 2010
    Messages:
    1,842
    Likes Received:
    18
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    What PHP handler are you using? The default PHP handler on cPanel is now suPHP. You can check which PHP handler you are using by clicking, in the WebHost Manager, Main >> Service Configuration >> Configure PHP and SuExec.

    If you are using suPHP, you can limit all accounts to using only the central php.ini file (usually /usr/local/lib/php.ini) by editing /opt/suphp/etc/suphp.conf and uncommenting the lines indicated in the following section:

    Code:
    [phprc_paths]
    ;Uncommenting these will force all requests to that handler to use the php.ini
    ;in the specified directory regardless of suPHP_ConfigPath settings.
    ;application/x-httpd-php=/usr/local/lib/
    ;application/x-httpd-php4=/usr/local/php4/lib/
    ;application/x-httpd-php5=/usr/local/lib/
    The semicolons (';') represent comments; remove them to cause the directives to take effect.

    This will cause all accounts to take their PHP settings from /usr/local/lib/php.ini or /usr/local/lib/php4/lib/php.ini, depending on whether you have PHP 4 or PHP 5 or both. The exact settings may be different on your server.
     
  5. bt4

    bt4 Well-Known Member

    Joined:
    Jul 1, 2010
    Messages:
    69
    Likes Received:
    0
    Trophy Points:
    6
    thank you very much
     
Loading...

Share This Page