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:per_user_php_ini [2014/07/29 19:03]
Michael Armstrong
— (current)
Line 1: Line 1:
-====== Allowing Per-User php.ini ====== 
  
-This document lists the options for allowing use of a per-user php.ini. The document assumes that you are running LiteSpeed Web Server (LSWS) off of Apache. (This applies to users using control panels.) Some of the methods mentioned here can also be used if you are running off LSWS-native configs. 
- 
-Per-user php.ini files are not compatible with [[http://​www.litespeedtech.com/​products/​litespeed-sapi/​php/​suexec-daemon-mode|suEXEC Daemon mode]]. Our [[http://​www.litespeedtech.com/​products/​litespeed-sapi/​php/​guide-to-suexec-setups|two other PHP suEXEC setups]] both support per-user php.ini. 
- 
-Some of the following methods can be used together. 
- 
-===== 1. Define PHPRC at the Server Level in the WebAdmin Console ===== 
- 
-Defining ''​PHPRC''​ in the WebAdmin console allows you to use a variable that can set a standard location for the php.ini file in each virtual host. 
- 
-In your Environment setting (WebAdmin console > Server > External App > lsphp5), enter: "​PHPRC=variable"​ 
- 
-Example: 
- 
-  PHPRC=$VH_ROOT 
- 
-The variables available for use are: 
- 
-  - $VH_ROOT: the virtual host's home directory 
-  - $VH_NAME: the virtual host's domain 
-  - $VH_USER: the virtual host's user 
- 
- ​**Note:​** ​ 
-   * Make sure the php.ini file is readable by the suEXEC user. 
-   * PHPRC is to use user-defined php.ini ONLY. 
- 
-===== 2. Define PHP_INI_SCAN_DIR in LSWS Server level External App Environment ===== 
- 
- Put something like "​PHP_INI_SCAN_DIR=$VH_ROOT/​php"​ in lsphp environment (Web Admin Console->​Server->​External App->​lsphp5->​Edit->​Environment). ​ 
- 
- ​**Note:​** ​ 
-   * This method is not recommended if you replace apache with suphp, use PHPRC is recommended 
-   * Make sure permission of php.ini file is readable by suEXEC user 
-   * PHP_INI_SCAN_DIR is to use user-defined php.ini (additional ini settings) on top of master/​default php.ini. 
-   * PHP_INI_SCAN_DIR is available for PHP 5.2.7 and up. 
-   * The $VH_ROOT, $VH_NAME, and $VH_USER variables may be used to refer to user's home directory, domain, or user. 
- 
- 
-===== 3. Define PHPIniDir directive in configuration (vhost httpd.conf) from control panel ===== 
- This can be done if only one vhost (user) needs its own php.ini (not for every vhost or multiple vhosts under one main account), "​PHPIniDir"​ can be used. 
- 
-<​file>​ 
-  - Add entry "​PHPIniDir /​path/​to/​custom_ini/​directory"​ to httpd.conf vhost section or a conf file included by vhost httpd.conf 
-  - Create custome ini file '/​path/​to/​custom_ini/​directory/​php.ini' ​ 
-  - Restart LSWS '​service lsws restart'​ (i.e. on CentOS) to make the change effective. 
-</​file>​ 
- ​**Note:​** ​ 
-   * PHPIniDir directive at vhost level is supported since LSWS 4.0.2 
-   * PHPIniDir directive is effective **ONLY IF** placed in the 1st (or main domain) vhost **OF THE ACCOUNT (USER)**. The one placed in subdomain vhost will be ignored even though it is just for that vhost. 
-   * **PHP suEXEC MUST BE ENABLED**. Otherwise, only the PHPIniDir defined in server'​s global vhost (catch-all vhost) is effective. 
-   * Changes in the php.ini will not be picked up until new PHP process starts. This is because php.ini is read the first time when a php process starts. 
- 
-====== Tips ====== 
-   * Option 2 could be used along with Option 1 or 3 without conflicts. However, it should rarely be needed in the per user setup. 
-   * Option 3 takes precedence over Option 1 should they be used at the same time. 
-   * PHP suEXEC **MUST BE ENABLED** in LSWS. 
  • Admin
  • Last modified: 2014/07/29 19:03
  • by Michael Armstrong