Custom php.ini per vhost (domain) on cPanel

Discussion in 'Install/Configuration' started by twhiting9275, Jul 3, 2014.

  1. twhiting9275

    twhiting9275 Member

    So, I'm trying to go through and make sense of this documentation here, but having no luck at all.
    LSWS version: 4.2.12
    lsphp5 environment:
    as well

    Full php5 configuration in image
    Whenever I go to any site on the server though, Scan this dir for additional .ini files is always empty, and it's just a global php.ini file loaded, despite the fact that valid php.ini files exist in separate directories

    Ideas on what could be wrong?

    Attached Files:

  2. mistwang

    mistwang LiteSpeed Staff

    You should remove the double quote.
    You must enable PHP suEXEC under "Server->general->Apache configuration"
    Check phpinfo() page see if the PHPRC environment has been set to the correct value or not.
    twhiting9275 likes this.
  3. twhiting9275

    twhiting9275 Member

    Like I mentioned, tried with and without the quote. that quote is from your wiki though ;)
    Yup, wasn't disabled
    This is helpful. Turns out $VH_ROOT points to the actual user's homedir (would think that would be VH_USER) (ie: /home/user), not the virtualhost (ie: /home/user/public_html/domain). While this is very useful, it would be better to change this to point to the domain's root. Any thought on how to do this?
  4. mistwang

    mistwang LiteSpeed Staff

    $VH_ROOT is the user's home directory.

    You can use something like


    or $VH_ROOT/php

    However, each account can only have one php.ini, so it wont work if you want per subdomain php.ini.
    Licensecart and twhiting9275 like this.
  5. twhiting9275

    twhiting9275 Member

    That makes sense then. Thank you for your help there. It's a bit different from using public_html/domain/php.ini , but I think it'll make it easier to manage per account php settings to use $VH_ROOT ;)
  6. Hedloff

    Hedloff Well-Known Member

    Is this still the same? Can a user still have one php.ini file under their account?
  7. Pong

    Pong Well-Known Member Staff Member

  8. Hedloff

    Hedloff Well-Known Member

    The link to CL on that page is not working.

    On Step 2 on that link, you tell us to point CL PHP Selector lsphp binary to for example:

    Is this wrong? On EasyApache 4 aswell?

    CL's howto is telling to use /usr/local/bin/lsphp:
  9. Pong

    Pong Well-Known Member Staff Member

    Link updated. It is due to CloudLinux documentation relocation.
    The main PHP handler "lsphp5" will remain untouched, pointing to "/usr/local/bin/lsphp" as indicated in CL's how to.

    Extra handlers should be created to handle your special per directory PHP requirements.

Share This Page