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:cpanel:use-cloudlinuxphpselector-on-ea4-with-lsws [2018/06/19 16:31]
Jackson Zhang [Changing the Default]
litespeed_wiki:cpanel:use-cloudlinuxphpselector-on-ea4-with-lsws [2019/01/09 20:42]
Jackson Zhang [alt-php within Multi-php Manager]
Line 87: Line 87:
  
 ===== alt-php within Multi-php Manager ===== ===== alt-php within Multi-php Manager =====
-**It will be supported from 5.3RC1**+**alt-php is supported from LSWS 5.3RC1 ​directly from MultiPHP Manager**
  
 +In cPanel & WHM version 66 and later, EasyApache 4 allows you to use Vendor-provided PHP versions such as CloudLinux PHP selector right from MultiPHP Manager, such as ''​alt-php44'',​ ''​alt-php51'',​ ''​alt-php52'',​ ''​alt-php53'',​ ''​alt-hpp54'',​ ''​alt-php55'',​ ''​alt-php56'',​ ''​alt-php70'',​ ''​alt-php71'',​ ''​alt-php72'',​ they have been supported by LiteSpeed from 5.3RC1. LSWS 5.2.x and below do not support them and if you are still using such LSWS legacy version, ​ please continue to use ''​ea-phpxx''​ only and follow the above steps to determine if CloudLinux PHP selector is used,  but not directly from MultiPHP Manager. ​
  
-In cPanel & WHM version 66 and later, EasyApache 4 allows you to use Vendor-provided PHP versions such as CloudLinux PHP selector ​right from MultiPHP Manager, such as ''​alt-php44''​, ''​alt-php51'',​ ''​alt-php52'',​ ''​alt-php53'',​ ''​alt-hpp54'',​ ''​alt-php55'',​ ''​alt-php56'',​ ''​alt-php70'',​ ''​alt-php71'',​ ''​alt-php72'',​ they will be supported by LiteSpeed from 5.3RC1. If your version under it, please continue ​to use ''​ea-phpxx'' ​and follow the above steps to determine if CloudLinux PHP selector is used,  ​but not directly from MultiPHP Manager +Using cpanel MultiPHP manager is recommended way since it is easy to understand ​and supports both ea-php and alt-php. ​ CloudLinux PHP selector sometime might be a little complicated ​to understand, hence not recommended. Advanced user can use either one as you prefer, as far as you understand how CloudLinux PHP selector ​with WHM/​cPanel ​MultiPHP Manager ​works together. The following section ​''​Why CloudLinux PHP Selector Works on Apache but Does Not Work on LSWS'' ​could be a good example of portraiting how complicated ​it is when a user trying to enforce everything ​to alt-php and also using CloudLinux PHP Selector. Unless you understand it wellWe don't recommend you go through such a complicated path without much benefit. ​ Bold simple could make your life easier
  
 {{ :​litespeed_wiki:​cpanel:​cpanel-multiphp-altphp.png?​600 |}} {{ :​litespeed_wiki:​cpanel:​cpanel-multiphp-altphp.png?​600 |}}
 +
 +
 +===== Why CloudLinux PHP Selector Works on Apache but Does Not Work on LSWS =====
 +In a cPanel EA4 and CloudLinux environment,​ Most of the LSWS LSPHP external apps such as ''​lsphpxx''​ are pointing to ''​ea-phpxx'',​ instead of ''​alt-phpxx''​. Only one external app, ''​cl_phpselector''​ is pointing to ''/​usr/​local/​bin/​lsphp''​ (the CloudLinux PHP selector binary).
 +  lsphp54->​ /​opt/​cpanel/​ea-php54/​root/​usr/​bin/​lsphp
 +  lsphp55->​ /​opt/​cpanel/​ea-php55/​root/​usr/​bin/​lsphp
 +  lsphp56->​ /​opt/​cpanel/​ea-php56/​root/​usr/​bin/​lsphp
 +  lsphp70->​ /​opt/​cpanel/​ea-php70/​root/​usr/​bin/​lsphp
 +  lsphp71->​ /​opt/​cpanel/​ea-php71/​root/​usr/​bin/​lsphp
 +  lsphp72->​ /​opt/​cpanel/​ea-php72/​root/​usr/​bin/​lsphp
 +  cl_phpselector->​ /​usr/​local/​bin/​lsphp
 +
 +PHP handlers:
 +  php  -> cl_phpselector
 +  php5 -> cl_phpselector
 +  php54-> lsphp54
 +  php55-> lsphp55 ​  
 +  php56-> lsphp56
 +  php70-> lsphp70
 +  php71-> lsphp71
 +  php72-> lsphp72
 +    ​
 +The above is the recommended way, and is the default setup for such an environment. ​
 +
 +{{ :​litespeed_wiki:​cpanel:​cpanel-ea4-cloudlinux-apache-lsws-different-php.png?​800 |}}
 +
 +Some users may want to point every external handler to ''​alt-phpxx'',​ like so:
 +  lsphp54->​ /​opt/​alt/​php54/​usr/​bin/​lsphp
 +  lsphp55->​ /​opt/​alt/​php55/​usr/​bin/​lsphp
 +  lsphp56->​ /​opt/​alt/​php56/​usr/​bin/​lsphp
 +  lsphp70->​ /​opt/​alt/​php70/​usr/​bin/​lsphp
 +  lsphp71->​ /​opt/​alt/​php71/​usr/​bin/​lsphp
 +  lsphp72->​ /​opt/​alt/​php72/​usr/​bin/​lsphp
 +  cl_phpselector->/​usr/​local/​bin/​lsphp
 +  ​
 +This causes a problem.
 +
 +For example: A user account inherits the cPanel system default PHP version, and the CloudLinux PHP selector is set to use ''​php70''​ for that user account. Apache seems to return the correct version of ''​php70'',​ but LSWS always seems to return ''​php56''​ (or whatver cPanel'​s Multi PHP Manager system default PHP version is).
 +
 +In actuality, there is nothing wrong with LiteSpeed Web Server. LSWS is following the correct CloudLinux-cPanel-EA4 PHP determination work flow. 
 +
 +  * **Apache**: When a user account inherits the cPanel system default PHP configuration from cPanel Multi PHP Manager, the CloudLinux PHP Selector is used. Hence it returns the right PHP version.  ​
 +  * **LSWS**: Since you changed the external app associated with the cPanel default version (''​ea-php56''​ in this example), it will look for the suffix ''​php56'',​ which points to ''​lsphp56''​.
 +
 +''​lsphp56''​ was:
 +  lsphp56->​ /​opt/​cpanel/​ea-php56/​root/​usr/​bin/​lsphp
 +
 +You changed it to:
 +  lsphp56->​ /​opt/​alt/​php56/​usr/​bin/​lsphp
 +
 +''/​opt/​alt/​php56/​usr/​bin/​lsphp''​ is differnt than cPanel'​s default ''​ea-php56''​(which is  ''/​opt/​cpanel/​ea-php56/​root/​usr/​bin/​lsphp''​),​ hence the CloudLinux PHP Selector won't be used. Instead, ''​lsphp56''​ (or, ''/​opt/​alt/​php56/​usr/​bin/​lsphp''​) will be always used for LSWS.
 +
 +So, how can you get the PHP version you want? The key is to tell LSWS to use the CloudLinux PHP selector instead of a particular version of alt-php.
 +
 +You can either update the external app ''​lsphp56''​ to point to PHP selector binary ''/​usr/​local/​bin/​lsphp'',​ or more easily, update the PHP handler of suffix ''​php56''​ to be served by ''​cl_phpselector''​ instead of ''​lsphp56''​.
 +
 +You can apply the second solution through the command line or through LSWS Web Admin Console.
 +
 +==== Through the Command Line ====
 +  vi /​usr/​local/​lsws/​conf/​httpd_config.xml
 +
 +Change:
 +    <​scriptHandler>​
 +      <​suffix>​php56</​suffix>​
 +      <​type>​lsapi</​type>​
 +      <​handler>​lsphp56</​handler>​
 +    </​scriptHandler>​
 +To:
 +    <​scriptHandler>​
 +      <​suffix>​php56</​suffix>​
 +      <​type>​lsapi</​type>​
 +      <​handler>​cl_phpselector</​handler>​
 +    </​scriptHandler>​
 +    ​
 +==== Through LSWS Web Admin Console ====
 +
 +Before:
 +{{ :​litespeed_wiki:​cpanel:​cpanel-ea4-cloudlinux-apache-lsws-different-php-beforefix.png?​800 |}}
 +After:
 +{{ :​litespeed_wiki:​cpanel:​cpanel-ea4-cloudlinux-apache-lsws-different-php-afterfix.png?​800 |}}
 +
 +Restart LSWS after any configuration change.
  • Admin
  • Last modified: 2019/09/25 15:43
  • by Jackson Zhang