Custom php.ini per vhost (domain) on cPanel

#1
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:
PHP_LSAPI_MAX_REQUESTS=5000
PHP_LSAPI_CHILDREN=5
“PHPRC=$VH_ROOT”
tried
PHP_LSAPI_MAX_REQUESTS=5000
PHP_LSAPI_CHILDREN=5
PHPRC=$VH_ROOT
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?
 

Attachments

mistwang

LiteSpeed Staff
#2
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.
 
#3
You should remove the double quote.
Like I mentioned, tried with and without the quote. that quote is from your wiki though ;)
You must enable PHP suEXEC under "Server->general->Apache configuration"
Yup, wasn't disabled
Check phpinfo() page see if the PHPRC environment has been set to the correct value or not.
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?
 
#5
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 ;)
 

Hedloff

Well-Known Member
#6
$VH_ROOT is the user's home directory.

You can use something like

$VH_ROOT/public_html

or $VH_ROOT/php

However, each account can only have one php.ini, so it wont work if you want per subdomain php.ini.
Is this still the same? Can a user still have one php.ini file under their account?
 

Hedloff

Well-Known Member
#8
When php process started, php.ini will be loaded from one location specified. So each account can only have one php.ini.

Are you looking for different php version per directory under same user/account ? CloudLinux PHP selector could be a choice:

https://www.litespeedtech.com/suppo...p_versions_per_directories_using_php_selector
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:
/opt/alt/php5x/usr/bin/lsphp

Is this wrong? On EasyApache 4 aswell?

CL's howto is telling to use /usr/local/bin/lsphp:
https://docs.cloudlinux.com/index.html?litespeed_support.html
 

Pong

Administrator
Staff member
#9
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.
 
Top