Migrating cpanel EA3 to EA4 with LiteSpeed

EasyApache is software that installs, configures, updates, and validates your web server, PHP, and other web server components.

EasyApache 4 (EA4) represents a total overhaul in how cPanel & WHM ships and maintains their Apache and PHP distributions. The following steps will show you how to configure LiteSpeed Web Server to work with cPanel + EasyApache 4.

Note: It is assumed that you have already made the switch from EasyApache 3 to EasyApache 4. Please note that you have to switch back to Apache web server before migration otherwise it may cause problems. Then you can either use LiteSpeed plugin for cpanel for one click LiteSpeed EA3 to EA4 upgrade or manually upgrade LiteSpeed to be EA4 compatible.

LiteSpeed EA3 to EA4 One Click Upgrade

Staring from version 2.1.8, LiteSpeed's WHM Plugin will detect and notify you if you need to upgrade LiteSpeed from EA3 to EA4 or vice versa.

The upgrade itself will be performed automatically after clicking “Resolve Now” and confirming. This is much easier than manually updating your configuration. To use this feature, please either upgrade LSWS to the latest version >= 5.1.7 or upgrade the LiteSpeed WHM Plugin separately to at least version 2.1.8. Upgrade LSWS will automatically upgrade the LiteSpeed WHM Plugin.

/usr/local/lsws/admin/misc/lsup.sh -f -v <latest-version>

Alternatively, you can run the upgrade script:

/usr/local/cpanel/whostmgr/docroot/cgi/lsws/migrate_ea3_to_ea4_litespeed.sh

If you are running CloudLinux and CL PHP Selector is your preferred way for all PHPs, please check how to configure cpanel ea4 + cloudlinux + LSWS to use CL php selector instead of ea4 multiphp.

The upgrade script is the easiest way. However if you still want to do it manually or try to understand how the upgrade works, please follow the following steps.

LiteSpeed EA3 to EA4 manual upgrade

Upgrade script mentioned above is always the best way. The following manually upgrade steps are for your knowledge only or you still want to keep your hand dirty for any reason.

EA4 uses the Software Collections Library (SCL) for PHP. The use of SCLs enable the installation of multiple concurrent version of PHP on the file system. SCL is installed at /opt/cpanel/ea-php*. You need to install corresponding LSAPI binary packages from cPanel EA4 repository for each php version to enable LiteSpeed work with ea4 phps.

For example, assuming ea-php54, ea-php55, ea-php56, ea-php70 have been installed, you will need to install ea-phpxx-php-litespeed ( xx means 54,55,56 and 70 ) packages.

  1. Install lsphp for EA4

    yum install ea-php54-php-litespeed ea-php55-php-litespeed ea-php56-php-litespeed ea-php70-php-litespeed

    Note: The lsphp binary will be installed to “/opt/cpanel/ea-phpxx/root/usr/bin/lsphp” (xx means 54,55,56 and 70)

  2. Copy default lsphp to the standard directory, assuming you are going to use php56 as default

    cp /opt/cpanel/ea-php56/root/usr/bin/lsphp /usr/local/bin/lsphp
  3. From the LiteSpeed Admin Console, create/modify the default lsphp5 command to “/usr/local/bin/lsphp”
    ln -sf /usr/local/bin/lsphp /usr/local/lsws/fcgi-bin/lsphp5
  4. Other than the default lsphp5 handler, create new lsphp54/lsphp55/lsphp56/lsphp70 handlers pointing to “/opt/cpanel/ea-phpxx/root/usr/bin/lsphp” (xx is 54,55,56 or 70) accordingly.
  5. Like the default handler where .php → lsphp5 and .php5 → lsphp5, set the related new handlers for surfixes .php54, .php55, .php56 and .php70 pointing to lsphp54, lsphp55, lsphp56 and lsphp70 respectively.
  6. Perform a Graceful Restart of LSWS.

When choosing a PHP version for a domain in cPanel Admin Home → Software → Multi-PHP Manager, LiteSpeed will now correctly use the selected version. PHP handlers should be “CGI” (can not be “DSO”) to able to choose different versions. Otherwise, LiteSpeed may only return the default version instead of the version you have selected from Multi-PHP manager.

If you are experienceing any of the following errors:

“MIME type [application/x-httpd-ea-php70] for suffix '.php' does not allow serving as static file, access denied!”

“MIME type [application/x-httpd-ea-php56] for suffix '.php' does not allow serving as static file, access denied!”

“MIME type [application/x-httpd-ea-php55] for suffix '.php' does not allow serving as static file, access denied!”

“MIME type [application/x-httpd-ea-php54] for suffix '.php' does not allow serving as static file, access denied!” 

It is likely that your PHP handler has not yet been properly configured. Please follow the steps above to configure it. You should also upgrade LiteSpeed Web Server to the latest version to ensure correct MIME type recognition.

Note: LSWS is not compatible with mod_ruid2 because LSWS does not allow the process user to change mid-process. Make sure that mod_ruid2 is disabled in your WHM settings when using LSWS. LSWS is compatible with Apache prefork or event MPM. If mod_ruid2 is enabled, a variety of functionality may be disrupted due to WHM creating files that the web server user cannot access.

If you are experienceing any of the following errors and your external apps and script handlers have been configurated, you might not install the following ea-phpxx on your server, you can use easy apache to install them to fix the errors.

2018-08-27 20:53:25.421588	ERROR	[config:scripthandler] use static file handler for suffix [php71]
2018-08-27 20:53:25.421606	ERROR	[config:scripthandler] Can not find handler with type: 17, name: lsphp72.
2018-08-27 20:53:25.421615	ERROR	[config:scripthandler] Can not find External Application: lsphp72, type: lsapi
2018-08-27 20:53:25.421623	ERROR	[config:scripthandler] use static file handler for suffix [php72]
2018-08-27 20:53:25.421668	ERROR	[config:scripthandler] Can not find handler with type: 17, name: lsphp54.
2018-08-27 20:53:25.421684	ERROR	[config:scripthandler] Can not find External Application: lsphp54, type: lsapi
2018-08-27 20:53:25.421693	ERROR	[config:scripthandler] use static file handler for suffix [php54]
2018-08-27 20:53:25.421711	ERROR	[config:scripthandler] Can not find handler with type: 17, name: lsphp55.
2018-08-27 20:53:25.421742	ERROR	[config:scripthandler] Can not find External Application: lsphp55, type: lsapi
2018-08-27 20:53:25.421752	ERROR	[config:scripthandler] use static file handler for suffix [php55]
[Mon Aug 27 20:53:26 2018] [notice] Finish reading Apache configuration, server configured -- resuming normal operations
2018-08-27 20:53:26.572142 [ALERT] [Child: 30527] LiteSpeed/5.2.8 Enterprise starts successfully!

[root@server1 opt]# find /opt/cpanel/ -name lsphp
/opt/cpanel/ea-php56/root/usr/bin/lsphp

User only installed ea-php56, but missing all the rest php versions. If you intended to do so, it is fine and the above error message can be saftly ignored.

  • Admin
  • Last modified: 2019/10/01 14:21
  • by Jackson Zhang