Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
litespeed_wiki:php:per-user-php-ini [2019/12/12 18:46]
Jackson Zhang
litespeed_wiki:php:per-user-php-ini [2020/01/01 15:13]
George Wang [8. Use of ''disable_functions'']
Line 152: Line 152:
 ===== 3. Define PHP_INI_SCAN_DIR at the Server Level in the WebAdmin Console ===== ===== 3. Define PHP_INI_SCAN_DIR at the Server Level in the WebAdmin Console =====
  
-Using the PHP_INI_SCAN_DIR environment variable allows you to use a variable that can set a standard location for the php.ini file in each virtual host. Unlike the PHPRC environment variable, though, PHP_INI_SCAN_DIR allows the use of the global php.ini file with the addition of a per-user php.ini.+Using the ''​PHP_INI_SCAN_DIR'' ​environment variable allows you to set a standard location for the php.ini file for each virtual host. Unlike the ''​PHPRC'' ​environment variable, though, ​''​PHP_INI_SCAN_DIR'' ​allows the use of the global php.ini file with the addition of a per-user php.ini. 
 + 
 +In a control panel environment such as with cPanel, ea-phpxx will normally load the main php.ini, then scan additional .ini files, like in this example with ea-php73:
  
-For the control panel environment such as cpanel, ea-phpxx will normally load the main php.ini then scan additional xxx.ini for each php packages already, such as ea-php73 as the following: 
 {{ :​litespeed_wiki:​php:​per-user-php-ini-additional-ini1.png?​800 |}} {{ :​litespeed_wiki:​php:​per-user-php-ini-additional-ini1.png?​800 |}}
  
-To avoid missing ​the above additional ​folder ​scanning from ''/​opt/​cpanel/​ea-php73/​root/​etc/​php.d'',​ you should specify ​PHP_INI_SCAN_DIR milti additional scanning folders ​instead of just one separating with '':''​. ​+To avoid missing ​any additional ​folders when scanning from ''/​opt/​cpanel/​ea-php73/​root/​etc/​php.d'',​ you should specify ​multiple ​additional scanning folders ​in ''​PHP_INI_SCAN_DIR'', ​separating ​them with '':''​. ​
  
-In your external application Environment setting (WebAdmin ​console ​> Server > External App > lsphp73), enter: ​+In your external application ​**Environment** setting (**WebAdmin ​Console ​> Server > External App > lsphp73**), enter: ​
  
   PHP_INI_SCAN_DIR=/​opt/​cpanel/​ea-php73/​root/​etc/​php.d:​$VH_ROOT/​public_html   PHP_INI_SCAN_DIR=/​opt/​cpanel/​ea-php73/​root/​etc/​php.d:​$VH_ROOT/​public_html
-or simplly as:+or simply:
   PHP_INI_SCAN_DIR=:​$VH_ROOT/​public_html  ​   PHP_INI_SCAN_DIR=:​$VH_ROOT/​public_html  ​
 {{ :​litespeed_wiki:​php:​per-user-php-ini-additional-ini2.png?​800 |}} {{ :​litespeed_wiki:​php:​per-user-php-ini-additional-ini2.png?​800 |}}
  
-After you save the change and restart LSWS, the phpinfo of the accounts using lsphp73 should change to similar to the following by scanning additional ''​.ini''​ for additional ​folder ​from ''​$VH_ROOT/​public_html''​.+After you save the change and restart LSWS, the phpinfo ​page of the accounts using lsphp73 should change to something ​similar to the following by scanning additional ''​.ini''​ for additional ​folders ​from ''​$VH_ROOT/​public_html''​:
 {{ :​litespeed_wiki:​php:​per-user-php-ini-additional-ini3.png?​800 |}} {{ :​litespeed_wiki:​php:​per-user-php-ini-additional-ini3.png?​800 |}}
  
 The variables available for use are: The variables available for use are:
  
-  - $VH_ROOT: the virtual host's home directory +  - ''​$VH_ROOT''​: the virtual host's home directory 
-  - $VH_NAME: the virtual host's domain +  - ''​$VH_NAME''​: the virtual host's domain 
-  - $VH_USER: the virtual host's user+  - ''​$VH_USER''​: the virtual host's user
  
  ​**Note:​** ​  ​**Note:​** ​
-  * This method is not recommended if you replace Apache with suPHP. When replacing Apache with suPHP, the PHPRC environment variable is recommended. +  * This method is not recommended if you replace Apache with suPHP. When replacing Apache with suPHP, the ''​PHPRC'' ​environment variable is recommended. 
-  * The PHP_INI_SCAN_DIR environment variable is available for PHP 5.2.7 and up.+  * The ''​PHP_INI_SCAN_DIR'' ​environment variable is available for PHP 5.2.7 and up.
  
-Starting from LSWS 5.3.x, LSWS may automatically configure external applications and script handlers for control panels, hence it may not have external applications or script handlers anymore. If you want to define ''​PHPRC''​ environment variable for all external applications,​ you can use ''​PHP'' ​tab.+Starting from LSWS 5.3.x, LSWS may automatically configure external applications and script handlers for control panels, hence it may not have external applications or script handlers anymore. If you want to define ​the ''​PHPRC''​ environment variable for all external applications,​ you can use the **PHP** tab.
  
 ===== 4. Define PHPRC in Apache Configs ===== ===== 4. Define PHPRC in Apache Configs =====
Line 219: Line 220:
   </​IfModule>​   </​IfModule>​
  
-===== 8. ''​disable_functions'' ​can only be used in global php.ini and can not be overriden by additional user's local .user.ini/​php.ini,​ nor .htaccess ​=====+===== 8. Use of ''​disable_functions''​ =====
  
-Please be aware, for security ​reason, ''​disable_functions''​ is unique and can not be used in .htaccess, ​user's local ''​.user.ini/​php.ini''​. You should ​only apply ''​disable_functions'' ​on global ​php.ini for LiteSpeed by modifying the value from ''/​opt/​cpanel/​ea-phpxx/​root/​etc/​php.ini''​ on cPanel/WHM.  It would be a security flaw if a user can modify it freely, hence it has been restricted by design ​from PHP itself, not from LiteSpeed. ​+Please be aware, for security ​and performance reasons, ''​disable_functions''​ is unique and can only be set in php.ini, cannot ​be used in .htaccess, ​nor be overridden via ''​php_admin_value''​. You can only apply ''​disable_functions'' ​via global ​or per-user php.ini. ​ It would be a security flaw if a user could modify it freely, hence it has been restricted by design ​in PHP itself, not by LiteSpeed. ​
  
  
  • Admin
  • Last modified: 2020/01/01 15:13
  • by George Wang