Actions

Difference between revisions of "Modules:ModLSPHP-Basic-Installation"

From OpenLiteSpeed Wiki

(Created page with "Category:Modules This wiki discusses how to add OpenLiteSpeed's ModLSPHP module. The ModLSPHP module, improves PHP performance while loading PHP into the currently runnin...")
 
Line 1: Line 1:
 
[[Category:Modules]]
 
[[Category:Modules]]
  
This wiki discusses how to add OpenLiteSpeed's ModLSPHP module. 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.
+
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 [[#Building The LiteSpeed ModLSPHP Module|built]].
 
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 [[#Building The LiteSpeed ModLSPHP Module|built]].

Revision as of 18:25, 2 February 2018


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 build.sh script.


cd /openlitespeed_download/src/modules/mod_lsphp
./build.sh


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

Once the build script has completed, a symbolic link will have been created in the current directory pointing to libphp7.so 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 mod_lsphp72.so pointing to /usr/local/php-7.2/libs/libphp7.so.

cd /home/user/lsws/modules
ln -s /usr/local/php-7.2/libs/libphp7.so mod_lsphp72.so


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 now change the default 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 can be created in the following step instead.

  1. Navigate to Server Configuration > Script Handler and click 'Edit' next to the current PHP script handler.
  2. 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!


Testing

In order to test that mod_lsphp has been loaded correctly, create a publicly accessible phpinfo() file and visit it using your browser. For example:

localhost:8088/phpinfo.php


At the top of this page you should see that you are using 'PHP Version 7.2.1-dev'.