Configuring cPanel + EasyApache 4 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. EA4 is not recommended for use with production servers yet, but if you would like to experience it early, 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

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

Preamble

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.

Configuration Steps

  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.

Possible Errors

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.

 
litespeed_wiki/cpanel/easyapache4-config.txt · Last modified: 2016/11/28 13:58 by Jackson Zhang