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:cloudlinux:different_php_versions_per_directories_using_php_selector [2017/02/13 18:42]
Jackson Zhang
litespeed_wiki:cloudlinux:different_php_versions_per_directories_using_php_selector [2017/07/06 16:12]
Kacey Schroeder
Line 1: Line 1:
-======How to set different ​PHP versions per directories using PHP Selector for LSWS======+======Setting Up Per-Directory Different ​PHP Versions Using PHP Selector for LSWS======
  
-Cloudlinux ​supports [[https://​www.cloudlinux.com/​cloudlinux-os-blog/​entry/​different-php-versions-per-directories-using-php-selector|different PHP versions per directory]]. ​If you are using control panel like cpanel, ​ you may use this for EA3 but it is not campatible for EA4 since EA4 support multi versions of PHP by default already+CloudLinux already ​supports [[https://​www.cloudlinux.com/​cloudlinux-os-blog/​entry/​different-php-versions-per-directories-using-php-selector|different PHP versions per directory]]. ​How is this different?.
  
-To use this cloudLinux featureMinor manual changes are required to apache configuration as the following:+In the standard CloudLinux PHP Selector setup, each user can select a different PHP versionbut only one version can be selected for the entire user account.
  
- ​Add ​the following section to the end of /​opt/​suphp/​etc/​suphp.conf :+If you require different PHP versions for different directories within one cage user account, you can follow ​the setup outlined in this wiki, but proceed carefully as these steps assume unmodified CloudLinux and cPanel configurations.
  
 +If you are using a control panel (like cPanel), you may use this for EA3. It is not recommended for EA4 installations.
 +
 +To use this feature on CloudLinux, minor manual changes to the Apache configuration are required as per the CloudLinux link above:
 +
 +1. Configure handlers for different versions and point them to already provided PHP-CGI binaries; they all are visible from CageFS inside. Add the following section to the end of /​opt/​suphp/​etc/​suphp.conf:​
   application/​x-httpd-php52="​php:/​opt/​alt/​php52/​usr/​bin/​php-cgi" ​   application/​x-httpd-php52="​php:/​opt/​alt/​php52/​usr/​bin/​php-cgi" ​
   application/​x-httpd-php53="​php:/​opt/​alt/​php53/​usr/​bin/​php-cgi" ​   application/​x-httpd-php53="​php:/​opt/​alt/​php53/​usr/​bin/​php-cgi" ​
Line 12: Line 17:
   application/​x-httpd-php55="​php:/​opt/​alt/​php55/​usr/​bin/​php-cgi" ​   application/​x-httpd-php55="​php:/​opt/​alt/​php55/​usr/​bin/​php-cgi" ​
   application/​x-httpd-php56="​php:/​opt/​alt/​php56/​usr/​bin/​php-cgi"​   application/​x-httpd-php56="​php:/​opt/​alt/​php56/​usr/​bin/​php-cgi"​
- +2. Add suphp handlers for each version, this should be done before other configs. On cPanel server, edit /​usr/​local/​apache/​conf/​includes/​pre_main_global.conf and add following section:
-Add suphp handlers for each version, this should be done before other configs. On cPanel server, edit **/​usr/​local/​apache/​conf/​includes/​pre_main_global.conf** and add following section: +
- +
-  <​IfModule mod_suphp.c>​  +
-  <​Directory /> +
   suPHP_AddHandler application/​x-httpd-php52 ​   suPHP_AddHandler application/​x-httpd-php52 ​
   suPHP_AddHandler application/​x-httpd-php53 ​   suPHP_AddHandler application/​x-httpd-php53 ​
   suPHP_AddHandler application/​x-httpd-php54 ​   suPHP_AddHandler application/​x-httpd-php54 ​
   suPHP_AddHandler application/​x-httpd-php55 ​   suPHP_AddHandler application/​x-httpd-php55 ​
-  suPHP_AddHandler application/​x-httpd-php56 ​ +  suPHP_AddHandler application/​x-httpd-php56
-  </​Directory>​  +
-  </​IfModule>​+
  
- You can do the following ​to make LiteSpeed compatible with php selector per directory.+This concludes ​the settings modifications.  
 + 
 +Now to make LiteSpeed compatible with PHP selector per directory:
    
  ​**Step1**:​ Force upgrade to the latest LSWS version  ​**Step1**:​ Force upgrade to the latest LSWS version
     /​usr/​local/​lsws/​admin/​misc/​lsup.sh -f -v <​version>​     /​usr/​local/​lsws/​admin/​misc/​lsup.sh -f -v <​version>​
-    ​ 
- ​**Step2**:​ Create handlers for **lsphp52/​lsphp53/​lsphp54/​lsphp55/​lsphp56/​lsphp70** pointing to cloud linux PHP selector lsphp binary, such as **/​opt/​alt/​php5x/​usr/​bin/​lsphp**. 
  
- ​**Step3**: ​Create ​suffixed **.php52 .php53 .php54 .php55 .php56 .php70** and associate them with above related ​    ​external app handlers.+ **Step2**: In the admin console, create handlers for **lsphp52/​lsphp53/​lsphp54/​lsphp55/​lsphp56/​lsphp70**. Each handler should point to a CloudLinux PHP selector LSPHP binary, such as **/​opt/​alt/​php5x/​usr/​bin/​lsphp**. 
 +{{ :​litespeed_wiki:​cloudlinux:​cpanel-ea3-multi-php-cl-php-selector.png?​700 |}} 
 +{{ :​litespeed_wiki:​cloudlinux:​cpanel-ea3-multi-php-cl-php-selector3.png?​500 |}} 
 + 
 + 
 + **Step3**: ​In the admin console, create ​suffixed **.php52 .php53 .php54 .php55 .php56 .php70** and associate them with above related external app handlers. 
 + 
 +{{ :​litespeed_wiki:​cloudlinux:​cpanel-ea3-multi-php-cl-php-selector2.png?​700 |}}
  
  ​**Step4**:​ Restart LSWS.  ​**Step4**:​ Restart LSWS.
 +
  
  
  • Admin
  • Last modified: 2017/07/06 16:12
  • by Kacey Schroeder