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.

Cloudlinux + CageFS + PHP Selector - how to update default php.ini for each PHP version?

Discussion in 'CloudLinux' started by ShawnL, Mar 3, 2016.

  1. ShawnL

    ShawnL Member

    Joined:
    Mar 3, 2016
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    US
    cPanel Access Level:
    Root Administrator
    My server runs Cloudlinux 5.11 with CageFS and PHP Selector. Default PHP version is 5.3.

    I have one account using PHP 5.3, one account using PHP 5.5, and one account using PHP 5.6.

    I'm trying to figure out how to update each account's php.ini or each PHP version's default php.ini.

    So far I've figured out how to update PHP 5.3's default php.ini:

    1. `phpinfo` on the PHP 5.3 account shows the loaded configuration file is from `/usr/selector.etc/php.ini`.

    2. Update /usr/local/lib/php.ini

    3. Run `cagefsctl --force-update`

    4. Rebuild Apache

    Then the modified `/usr/local/lib/php.ini` is reflected on the `phpinfo`.

    However, for PHP 5.5. and 5.6 accounts, I can't figure out how to update their default php.ini's.

    1. Their `phpinfo` shows the loaded configuration files are from `/opt/alt/php55/etc/php.ini` and `/opt/alt/php56/etc/php.ini`

    2. Update those files

    3. Run `cagefsctl --force-update`

    4. Rebuild Apache

    Afterwards, the changes of these php.ini's are reverted! So where is the right place to change these PHP versions' default php.ini's?

    Being able to update each PHP version's default php.ini would work for me, but it would be even easier and more flexible if each domain account (or even each folder) can have its own php.ini.

    I've tried `/public_html/php.ini` and `/public_html/.htaccess`. They don't take effect at all. `ini_set` in script works though, but of course I don't want to reply on just `ini_set`.
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    648
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    Cloud Linux documents this at:

    CloudLinux Documentation

    Per the document:

    Could you verify if the issue persists if you run the "cagefsctl --rebuild-alt-php-ini" command after editing the files?

    Also, as far as individual users, this is documented at:

    CloudLinux Documentation

    Thank you.
     
  3. ShawnL

    ShawnL Member

    Joined:
    Mar 3, 2016
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    US
    cPanel Access Level:
    Root Administrator
    After modifying /opt/alt/php55/etc/php.ini

    Running "cagefsctl --rebuild-alt-php-ini" WORKS!!

    Looks like the default PHP version and alternative versions have different php.ini update processes.

    To update an individual user's php.ini, do I go to "/etc/cl.php.d/alt-phpXX/alt_php.ini" ?

    And then run ""cagefsctl --rebuild-alt-php-ini" ?

    When I try to enter CageFs for a user, I got error:

    shell-init: error retrieving current directory: getcwd: cannot access parent directories: Invalid argument
    chdir: error retrieving current directory: getcwd: cannot access parent directories: Invalid argument

    Is it normal? I can still locate "/etc/cl.php.d/alt-phpXX/alt_php.ini" though.

    Thanks a lot!!
     
    #3 ShawnL, Mar 7, 2016
    Last edited: Mar 7, 2016
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    648
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    I am happy to see the issue is now resolved. Note you can view the "Individual PHP.ini files" section under "Configuration" in the document referenced in my earlier post. As far as the additional error messages, please open a new thread as that does not appear to be related to the original issue.

    Thank you.
     
  5. dialhost

    dialhost Registered

    Joined:
    Jun 17, 2005
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1

    Michael,

    If the user directly edit the file located in /home/user/.cl.selector/alt_phpxx.cfg, the rebuild will then disregard the options that the administrator has allowed to be changed in php.conf

    It is true that user may not use the interface again, otherwise overwrites the .cfg, but if the user edit this file and another user or administrator run the rebuild command, the settings will be overwritten for that user.

    What you think about this? Would be a Security breach?

    I think is a validation would be needed and apply only what is in php.conf and disregard anything in the .cfg file?

    Thanks.
    Flavio
    DialHost from Brazil
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    648
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
  7. dialhost

    dialhost Registered

    Joined:
    Jun 17, 2005
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Michael,

    You can reproduce with the following steps:

    First:
    Save the settings on the interface to the desired settings and are also allowed by the php.conf

    Second:
    It will be created the directory /home/USER/.cl.selector/ with cfg file.

    Third:
    Edit the corresponding cfg file to version.
    vi /home/USER/.cl.selector/alt_phpxx.cfg

    Add such a function that was not allowed in php.conf
    like:
    disable_functions = "";

    Fourth:
    Reduild the php.ini
    cagefsctl --rebuild-alt-php-ini

    You will notice that does not validate the function that is described in the .cfg file.

    I know if change again in the interface, the cfg file is modified.
    But you can change this config file and wait for rebuild. So the configuration it will be validated.

    Can you understand the steps?

    Thanks.
     
  8. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    648
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page