Can't load user PHP.INI

Discussion in 'PHP' started by bloom360, Nov 19, 2017.

  1. bloom360

    bloom360 Active Member

    Hello,
    I am running LS Enterprise on CentOS 6.9 on WHM as follows:
    - Run on Startup: NO
    - Auto Start: Through CGI Daemon
    - PHP suEXEC: Yes
    - On WHM pre_virtualhost_global.conf:
    <IfModule LiteSpeed>
    LSPHP_ProcessGroup on
    LSPHP_Workers 15
    </IfModule>​
    - On LS External App > Environment added "LSPHP_ENABLE_USER_INI=on"
    - Open Base Dir enabled on WHM

    When I edit some of the values using cPanel's GUI, especially max execution, memory limit and max upload, they work no problem.
    However, using the same GUI, if I enable url fopen, nothing happens. I checked on a phpinfo and neither of the local files php.ini or .user.ini are being loaded.
    I particularly need to set these but they are being entirely ignored?
    Code:
    upload_tmp_dir = /something/else
    opcache.enable=1
    opcache.enable_cli=1
    opcache.interned_strings_buffer=8
    opcache.max_accelerated_files=10000
    opcache.memory_consumption=128
    opcache.save_comments=1
    opcache.revalidate_freq=1
    So my question is how to make LS load user .ini files and also, why in the world is it reading properly the max execution and other vars, but not others. Do I need to manually enable which directives LS will load via a user ini?
    Many thanks
     
    Last edited by a moderator: Nov 22, 2017
  2. NiteWave

    NiteWave Administrator

  3. bloom360

    bloom360 Active Member

    Where can I find my version number?
    And if it is old, how can I update it? I found your docs say the Compile PHP tool should no longer be used.
     
  4. Pong

    Pong Well-Known Member Staff Member

    If you use multi-PHP from cpanel, you can go through whm admin multi-php ini editor or directly modify cpanel ea php.ini. The same way you need to do when using cpanel and apache.
     
  5. bloom360

    bloom360 Active Member

    Where can i check my version of LSAPI and if needed, how can i update it?
     
  6. NiteWave

    NiteWave Administrator

    phpinfo page will show lsapi version.
    yes, best to use yum or apt to install lsphp now, instead of build it yourself.
     
  7. bloom360

    bloom360 Active Member

    I am running WHM, can i just update directly via yum and nothing will break?

    Second, would it just be yum upgrade lsphp ? Or do i need to update the repository first? Or add parameters to the command so it compiles with certain modules? Can you please provide exact steps for CentOS 6.9? This is not my expertise and i am worried to break the server entirely.
    Thanks
     
  8. NiteWave

    NiteWave Administrator

    if you use WHM, no need manually run "yum upgrade lsphp", WHM/cPanel will do it for you.
    what's your WHM version, are you using easyapache 3 or 4 ? have you created a phpinfo page ?
     
  9. bloom360

    bloom360 Active Member

    I have checked and have LiteSpeed V6.11 according to phpinfo.
    That means I should be able to load separate ini files, no?
    phpinfo also says the environment variable LSPHP_ENABLE_USER_INI is ON, still the ini files are having full effect. As mentioned in an earlier message, I can set max memory and some variables, but they seem to ignore most other directives.
     
  10. NiteWave

    NiteWave Administrator

    http://php.net/manual/en/configuration.file.per-user.php
    I created a .user.ini file:
    Code:
    max_execution_time=666
    upload_tmp_dir=/tmp
    and access phpinfo,
    max_execution_time has effect, but upload_tmp_dir no effect.
    this is because http://www.php.net/manual/en/ini.list.php
    Code:
    upload_tmp_dir    PHP_INI_SYSTEM
    max_execution_time  PHP_INI_ALL
    so you can change max_execution_time via .user.ini, but can't change upload_tmp_dir via .user.ini

    if you want to enable per user php.ini, please refer
    https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:php:per-user-php-ini
     
    Last edited by a moderator: Nov 22, 2017
  11. bloom360

    bloom360 Active Member

    Thanks, I wanted to use PHP_INI_SCAN_DIR=$VH_ROOT/public_html but this held me back:
    Given my specs (see first message in this thread) do you advise I should or should not use this method?
    Regards
     
    Last edited by a moderator: Nov 22, 2017
  12. Jon K

    Jon K Administrator Staff Member

    I would try something like
    Code:
    PHP_INI_SCAN_DIR=:$VH_ROOT/public_html
    The : inside of there allows it to add all the other .ini's as well but will prioritize anything in public_html.
     
  13. bloom360

    bloom360 Active Member

    I will try that, thanks.
    And about my other question of this method not being recommended?
     
  14. Pong

    Pong Well-Known Member Staff Member

    Do you use SuPHP on apache? mostly likely not since fastcgi is used most in WHM. If so, then no need to worry.
     
  15. bloom360

    bloom360 Active Member

    Hi,
    Yes I have mod_suphp installed on the active Easy Apache 4 profile. Does this mean that PHP_INI_SCAN_DIR is not recommended?
    Server is running on WHM 68.0.15, by the way.
     
  16. NiteWave

    NiteWave Administrator

    yes, as our wiki has stated:
     

Share This Page