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
Next revision Both sides next revision
litespeed_wiki:php:per-user-php-ini [2019/08/29 21:02]
Jackson Zhang
litespeed_wiki:php:per-user-php-ini [2019/12/12 16:58]
Jackson Zhang
Line 6: Line 6:
  
 =====  Supports cPanel MultiPHP INI Editor out of the box ===== =====  Supports cPanel MultiPHP INI Editor out of the box =====
-When a user login to cPanel and edit his own php settings through [[https://​documentation.cpanel.net/​display/​82Docs/​MultiPHP+INI+Editor+for+cPanel|cPanel ​MultiPHP INI Editor]] (cPanel ​>> Home >> Software ​>> MultiPHP INI Editor), ​cPanel MultiPHP INI Editor ​will save changes to three files in /​home/​$USER/​public_html/: ​  ​php.ini file, the user.ini file, and .htaccess file. +When a user logs in to cPanel and edits PHP settings through ​cPanel'​s ​[[https://​documentation.cpanel.net/​display/​82Docs/​MultiPHP+INI+Editor+for+cPanel|MultiPHP INI Editor]] (**cPanel > Home > Software > MultiPHP INI Editor**), the editor ​will save changes to three files in ''​/​home/​$USER/​public_html/​''​the ''​php.ini'' ​file, the ''​user.ini'' ​file, and the ''​.htaccess'' ​file. 
  
 For example: For example:
Line 78: Line 78:
   zlib.output_compression = Off   zlib.output_compression = Off
  
-Why the same changes are being saved to three different files at the same time? It is because ​of different ​php handler ​will use different files to apply the settings. ​User may change handler ​sometimes ​and three files keeping the same changes ​will make sure cPanel MultiPHP INI Editor settings will apply regardless of handler change.+You probably noticed that the same changes are being saved to three different files at the same time. This is because different ​PHP handlers ​will use different files to apply the settings. ​A user may change ​the handler ​at some point, ​and the three files will be udated accordingly to ensure the cPanel MultiPHP INI Editor settings will continue to apply.
  
-For Apache SuPHP, it will use php.ini. ​For Apache PHP CGI and PHP-fpm, it will use .user.ini. For CloudLinux mod_lsapi for Apache, it will use .htaccess. LiteSpeed will use settings in .htaccess.  ​+Apache SuPHP uses php.ini. ​
  
-LiteSpeed will be compatible with cPanel MultiPHP INI Editor out of box without extra configuration required. Please also keep in mind that you can not manually change settings in one file through ssh access ​and you will need to use cPanel MultiPhP INI Editor GUI to make any changes for your test.+Apache PHP CGI and PHP-fpm ​use .user.ini
  
-If in any situation, ​you explicitly want to apply /​home/​$USER/​public_html/​php.ini regardless of the cpanel ​default multi-files implementation,​ you will need to use ''​PHP_INI_SCAN_DIR''​ to manually set up as instructed ​earlier ​in this wiki, but it is not recommended ​to do so and you are encouraged to just use cPanel MultiPHP INI Editor ​ways of implementation+CloudLinux mod_lsapi for Apache uses .htaccess.  
 + 
 +LiteSpeed uses .htaccess. ​  
 + 
 +LiteSpeed is compatible with cPanel MultiPHP INI Editor out of the box with no extra configuration required. Please also keep in mind that you cannot manually change settings ​in any of the files through SSH. You must use cPanel MultiPhP INI Editor GUI to make any changes for your test. 
 + 
 +If at any time you explicitly want to apply ''​/​home/​$USER/​public_html/​php.ini'', ​regardless of the cPanel ​default multi-file implementation,​ you will need to use ''​PHP_INI_SCAN_DIR''​ to manually set it up as instructed ​later in this wiki. Howeverthis is not recommendedand you are encouraged to just use cPanel MultiPHP INI Editor.
  
 ===== 1. Define PHPRC or PHP_INI_SCAN_DIR for a domain on cPanel server ===== ===== 1. Define PHPRC or PHP_INI_SCAN_DIR for a domain on cPanel server =====
Line 148: Line 154:
 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 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.
  
-In your external application Environment setting (WebAdmin console > Server > External App > lsphp5)enter: ''​PHP_INI_SCAN_DIR=variable/​php.ini/​directory''​+For the control panel environment such as cpanelea-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 |}}
  
-Example:+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 ''​:''​.  
 + 
 +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 
 +or simplly as: 
 +  PHP_INI_SCAN_DIR=:​$VH_ROOT/​public_html ​  
 +{{ :​litespeed_wiki:​php:​per-user-php-ini-additional-ini2.png?​800 |}}
  
-  PHP_INI_SCAN_DIR=$VH_ROOT/​public_html+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''​. 
 +{{ :​litespeed_wiki:​php:​per-user-php-ini-additional-ini3.png?​800 |}}
  
 The variables available for use are: The variables available for use are:
  • Admin
  • Last modified: 2020/01/01 15:13
  • by George Wang