From OpenLiteSpeed Wiki

Revision as of 18:57, 2 February 2018 by Malegre (talk | contribs) (Testing)

This wiki discusses how to add OpenLiteSpeed's ModLSPHP module (mod_lsphp). The ModLSPHP module, improves PHP performance while loading PHP into the currently running server process, reducing overall resource usage. This module also takes advantage of support for multi-threaded applications found in newer versions of PHP.

For this guide, we assume you already have a working installation of OpenLiteSpeed 1.5.0 RC1 or greater. Module support was made available in version 1.3 but the ModLSPHP module is only available and supported as of version 1.5.0 RC1. The LSPHP module is not added to OpenLiteSpeed installations automatically and must be built.

Note: As this is still an RC release module some strange behavior may be observed. If any bugs are encountered while using this module, please do not hesitate to report them to <place_holder>. Thank you!

Installing The LiteSpeed ModLSPHP Module

Download and install OpenLiteSpeed 1.5.0 RC1 or higher if you have not done so already.

The ModLSPHP Module is available as of OpenLiteSpeed version 1.5.0 RC1 and, at the time of this writing, uses a custom built version of PHP 7.2.1.

Build The LiteSpeed ModLSPHP Module

Go into the ModLSPHP Module directory /openlitespeed_download/src/modules/mod_lsphp and run the script.

cd /openlitespeed_download/src/modules/mod_lsphp

Should any dependency issues arise, please install said dependencies now and re-run the script.

Once the build script has completed, a symbolic link will have been created in the current directory pointing to in a newly created PHP directory (located in the same directory as openlitespeed_download). A phpdbg directory will also have been created parallel to the newly created PHP directory.

At this point you may optionally copy/create a php.ini file for use with mod_lsphp and place it in the phpdbg/php-7.2/lib64 directory.

Add The Module To The Modules Directory

To add the module to OpenLitespeed, the symbolic link created at the end of the last step should be re-created in OpenLiteSpeed's modules directory. For this example we will assume the default OpenLiteSpeed location of /usr/local/lsws with symbolic link pointing to /usr/local/php-7.2/libs/

cd /home/user/lsws/modules
ln -s /usr/local/php-7.2/libs/

Setting up the module

Now that the module has been added to the OpenLiteSpeed modules directory, we can now configure it to be used through the WebAdmin Console. These steps can be performed at either the server or virtual host level with virtual host level configurations overriding server level configurations.

  1. Log into the WebAdmin Console and navigate to Server Configuration > Modules and click 'Add' at the top right of the screen.
  2. Fill in the 'Module' field with the module name, in this case mod_lsphp72, and save.

With the module defined, we will configure a PHP handler to use it.

Note: If your server contains sites that may not be PHP 7 ready, a new handler with the appropriate Suffixes, such as php7, should be created in the following step.

  1. Navigate to Server Configuration > Script Handler and either click 'Edit' next to the current PHP script handler or click the 'Add' button at the top right to create a new handler.
  2. If creating a new script handler, set the script suffix(es) that you would like it to handle. For example, suffix php7 will handle all files ending in .php7. Be careful not to use a suffix already handled by an existing script handler as the existing handler will be overwritten on save.
  3. Change the 'Handler Type' to Module Handler, select the newly created mod_lsphp72 as the 'Handler Name', and save.

Congratulations, OpenLiteSpeed should now be configured to use mod_lsphp!


In order to test that mod_lsphp has been loaded correctly, create a publicly accessible phpinfo() file ending in the suffix set in the mod_lsphp72 script handler and visit it using your browser. For example:


or, if a new handler was created for suffix php7:


If the module was installed and configured correctly, you should see PHP Version 7.2.1-dev at the top of this page.