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 Both sides next revision
litespeed_wiki:php:per-user-php-ini [2019/08/29 21:00]
Jackson Zhang [8 Supports MultiPHP INI Editor for cPanel out of the box]
litespeed_wiki:php:per-user-php-ini [2019/08/29 21:02]
Jackson Zhang
Line 4: Line 4:
  
 The following steps show you how to do it when you are running off LSWS-native configs or running LiteSpeed Web Server (LSWS) off of Apache configurations. If running LSWS using native configs, please take a look at the [[litespeed_wiki:​php:​per-user-php-ini#​notes|Notes]] section. The following steps show you how to do it when you are running off LSWS-native configs or running LiteSpeed Web Server (LSWS) off of Apache configurations. If running LSWS using native configs, please take a look at the [[litespeed_wiki:​php:​per-user-php-ini#​notes|Notes]] section.
 +
 +=====  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. 
 +
 +For example:
 +  [/​home/​blogu1/​public_html]#​ ll
 +  -rw-r--r-- ​ 1 blogu1 blogu1 4484 Aug 29 12:25 .htaccess
 +  -rw-r--r-- ​ 1 blogu1 blogu1 ​ 576 Aug 29 12:25 php.ini
 +  -rw-r--r-- ​ 1 blogu1 blogu1 ​ 582 Aug 29 12:25 .user.ini
 +
 +in .htaccess
 +  # BEGIN cPanel-generated php ini directives, do not edit
 +  # Manual editing of this file may result in unexpected behavior.
 +  # To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
 +  # For more information,​ read our documentation (https://​go.cpanel.net/​EA4ModifyINI)
 +  <​IfModule php7_module>​
 +   ​php_flag display_errors Off
 +   ​php_value max_execution_time 57
 +   ​php_value max_input_time 60
 +   ​php_value max_input_vars 1000
 +   ​php_value memory_limit 33M
 +   ​php_value post_max_size 8M
 +   ​php_value session.gc_maxlifetime 1440
 +   ​php_value session.save_path "/​var/​cpanel/​php/​sessions/​ea-php72"​
 +   ​php_value upload_max_filesize 2M
 +   ​php_flag zlib.output_compression Off
 +  </​IfModule>​
 +  <​IfModule lsapi_module>​
 +   ​php_flag display_errors Off
 +   ​php_value max_execution_time 57
 +   ​php_value max_input_time 60
 +   ​php_value max_input_vars 1000
 +   ​php_value memory_limit 33M
 +   ​php_value post_max_size 8M
 +   ​php_value session.gc_maxlifetime 1440
 +   ​php_value session.save_path "/​var/​cpanel/​php/​sessions/​ea-php72"​
 +   ​php_value upload_max_filesize 2M
 +   ​php_flag zlib.output_compression Off
 +  </​IfModule>​
 +  # END cPanel-generated php ini directives, do not edit
 +
 +in .user.ini ​
 +  ; cPanel-generated php ini directives, do not edit
 +  ; Manual editing of this file may result in unexpected behavior.
 +  ; To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
 +  ; For more information,​ read our documentation (https://​go.cpanel.net/​EA4ModifyINI)
 +  [PHP]
 +  display_errors = Off
 +  max_execution_time = 57
 +  max_input_time = 60
 +  max_input_vars = 1000
 +  memory_limit = 33M
 +  post_max_size = 8M
 +  session.gc_maxlifetime = 1440
 +  session.save_path = "/​var/​cpanel/​php/​sessions/​ea-php72"​
 +  upload_max_filesize = 2M
 +  zlib.output_compression = Off
 +                             
 +in  php.ini
 +  ; cPanel-generated php ini directives, do not edit
 +  ; Manual editing of this file may result in unexpected behavior.
 +  ; To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
 +  ; For more information,​ read our documentation (https://​go.cpanel.net/​EA4ModifyINI)
 +  display_errors = Off
 +  max_execution_time = 57
 +  max_input_time = 60
 +  max_input_vars = 1000
 +  memory_limit = 33M
 +  post_max_size = 8M
 +  session.gc_maxlifetime = 1440
 +  session.save_path = "/​var/​cpanel/​php/​sessions/​ea-php72"​
 +  upload_max_filesize = 2M
 +  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.
 +
 +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.  ​
 +
 +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.
 +
 +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. ​
  
 ===== 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 132: Line 213:
   * For native LSWS installs, these variables ($VH_ROOT, $VH_NAME, $VH_USER, etc.) need to be inside of a Virtual Host External App Environment Section, and not inside the general Server External App Environment Section. This is because the variables are expanded on start up, so the VH_* variables cannot be expanded during server level configurations.   * For native LSWS installs, these variables ($VH_ROOT, $VH_NAME, $VH_USER, etc.) need to be inside of a Virtual Host External App Environment Section, and not inside the general Server External App Environment Section. This is because the variables are expanded on start up, so the VH_* variables cannot be expanded during server level configurations.
  
-===== 8 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.  
  
-For example: 
-  [/​home/​blogu1/​public_html]#​ ll 
-  -rw-r--r-- ​ 1 blogu1 blogu1 4484 Aug 29 12:25 .htaccess 
-  -rw-r--r-- ​ 1 blogu1 blogu1 ​ 576 Aug 29 12:25 php.ini 
-  -rw-r--r-- ​ 1 blogu1 blogu1 ​ 582 Aug 29 12:25 .user.ini 
- 
-in .htaccess 
-  # BEGIN cPanel-generated php ini directives, do not edit 
-  # Manual editing of this file may result in unexpected behavior. 
-  # To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor) 
-  # For more information,​ read our documentation (https://​go.cpanel.net/​EA4ModifyINI) 
-  <​IfModule php7_module>​ 
-   ​php_flag display_errors Off 
-   ​php_value max_execution_time 57 
-   ​php_value max_input_time 60 
-   ​php_value max_input_vars 1000 
-   ​php_value memory_limit 33M 
-   ​php_value post_max_size 8M 
-   ​php_value session.gc_maxlifetime 1440 
-   ​php_value session.save_path "/​var/​cpanel/​php/​sessions/​ea-php72"​ 
-   ​php_value upload_max_filesize 2M 
-   ​php_flag zlib.output_compression Off 
-  </​IfModule>​ 
-  <​IfModule lsapi_module>​ 
-   ​php_flag display_errors Off 
-   ​php_value max_execution_time 57 
-   ​php_value max_input_time 60 
-   ​php_value max_input_vars 1000 
-   ​php_value memory_limit 33M 
-   ​php_value post_max_size 8M 
-   ​php_value session.gc_maxlifetime 1440 
-   ​php_value session.save_path "/​var/​cpanel/​php/​sessions/​ea-php72"​ 
-   ​php_value upload_max_filesize 2M 
-   ​php_flag zlib.output_compression Off 
-  </​IfModule>​ 
-  # END cPanel-generated php ini directives, do not edit 
- 
-in .user.ini ​ 
-  ; cPanel-generated php ini directives, do not edit 
-  ; Manual editing of this file may result in unexpected behavior. 
-  ; To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor) 
-  ; For more information,​ read our documentation (https://​go.cpanel.net/​EA4ModifyINI) 
-  [PHP] 
-  display_errors = Off 
-  max_execution_time = 57 
-  max_input_time = 60 
-  max_input_vars = 1000 
-  memory_limit = 33M 
-  post_max_size = 8M 
-  session.gc_maxlifetime = 1440 
-  session.save_path = "/​var/​cpanel/​php/​sessions/​ea-php72"​ 
-  upload_max_filesize = 2M 
-  zlib.output_compression = Off 
-                              
-in  php.ini 
-  ; cPanel-generated php ini directives, do not edit 
-  ; Manual editing of this file may result in unexpected behavior. 
-  ; To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor) 
-  ; For more information,​ read our documentation (https://​go.cpanel.net/​EA4ModifyINI) 
-  display_errors = Off 
-  max_execution_time = 57 
-  max_input_time = 60 
-  max_input_vars = 1000 
-  memory_limit = 33M 
-  post_max_size = 8M 
-  session.gc_maxlifetime = 1440 
-  session.save_path = "/​var/​cpanel/​php/​sessions/​ea-php72"​ 
-  upload_max_filesize = 2M 
-  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. 
- 
-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.  ​ 
- 
-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. 
- 
-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. ​ 
  
 ===== Troubleshoot ===== ===== Troubleshoot =====
  • Admin
  • Last modified: 2020/01/01 15:13
  • by George Wang