How to Install OpenLiteSpeed with PHP 7 in CentOS

To Install and Configure OpenLiteSpeed with PHP 7 in CentOS 7

OpenLiteSpeed is a free high performance and lightweight HTTP server that uses a Web user interface administration. It is well known for its performance and low memory consumption. Installation of OpenLiteSpeed with PHP 7 in CentOS is explained in this article.

Install the following repo to download Openlitespeed.

[root@linuxhelp1 ~]# rpm -ivh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el7.noarch.rpm
Retrieving http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el7.noarch.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:litespeed-repo-1.1-1.el7.centos  ################################# [100%]

Now you can start installing the Openlitespeed package, by using the following command.

[root@linuxhelp1 ~]# yum install openlitespeed14.x86_64 -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.nbrc.ac.in
 * extras: mirror.nbrc.ac.in
 * updates: mirror.nbrc.ac.in
Package openlitespeed14 is obsoleted by openlitespeed, trying to install openlitespeed-1.4.20-1.el7.centos.x86_64 instead
Resolving Dependencies
-->  Running transaction check
--->  Package openlitespeed.x86_64 0:1.4.20-1.el7.centos will be installed
-->  Processing Dependency: geoip for package: openlitespeed-1.4.20-1.el7.centos.x86_64
-->  Running transaction check
--->  Package GeoIP.x86_64 0:1.5.0-9.el7 will be installed
.
.
.
  Verifying  : openlitespeed-1.4.20-1.el7.centos.x86_64                                                                     1/2 
  Verifying  : GeoIP-1.5.0-9.el7.x86_64                                                                                     2/2 

Installed:
  openlitespeed.x86_64 0:1.4.20-1.el7.centos                                                                                    

Dependency Installed:
  GeoIP.x86_64 0:1.5.0-9.el7                                                                                                    

Complete!

Run the following command to install the epel repository.

[root@linuxhelp1 ~]# yum install epel-release -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.nbrc.ac.in
 * extras: mirror.nbrc.ac.in
 * updates: mirror.nbrc.ac.in
Resolving Dependencies
-->  Running transaction check
--->  Package epel-release.noarch 0:7-6 will be installed
-->  Finished Dependency Resolution
.
.
.
Running transaction
  Installing : epel-release-7-6.noarch                                                                                      1/1 
  Verifying  : epel-release-7-6.noarch                                                                                      1/1 

Installed:
  epel-release.noarch 0:7-6                                                                                                     

Complete!

Then run the following command to install the php 7 and it’ s extension for Openlightspeed.

[root@linuxhelp1 ~]# yum install lsphp70 lsphp70-mysqlnd lsphp70-process lsphp70-mbstring lsphp70-mcrypt lsphp70-gd lsphp70-opcache lsphp70-bcmath lsphp70-pdo lsphp70-common lsphp70-xml -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.nbrc.ac.in
 * epel: epel.mirror.net.in
 * extras: mirror.nbrc.ac.in
 * updates: mirror.nbrc.ac.in
Resolving Dependencies
-->  Running transaction check
--->  Package lsphp70.x86_64 0:7.0.9-1.el7.centos will be installed
--->  Package lsphp70-bcmath.x86_64 0:7.0.9-1.el7.centos will be installed
--->  Package lsphp70-common.x86_64 0:7.0.9-1.el7.centos will be installed
.
.
.
Installed:
  lsphp70.x86_64 0:7.0.9-1.el7.centos                             lsphp70-bcmath.x86_64 0:7.0.9-1.el7.centos                    
  lsphp70-common.x86_64 0:7.0.9-1.el7.centos                      lsphp70-gd.x86_64 0:7.0.9-1.el7.centos                        
  lsphp70-mbstring.x86_64 0:7.0.9-1.el7.centos                    lsphp70-mcrypt.x86_64 0:7.0.9-1.el7.centos                    
  lsphp70-mysqlnd.x86_64 0:7.0.9-1.el7.centos                     lsphp70-opcache.x86_64 0:7.0.9-1.el7.centos                   
  lsphp70-pdo.x86_64 0:7.0.9-1.el7.centos                         lsphp70-process.x86_64 0:7.0.9-1.el7.centos                   
  lsphp70-xml.x86_64 0:7.0.9-1.el7.centos                        

Dependency Installed:
  libmcrypt.x86_64 0:2.5.8-13.el7                                                                                               

Complete!

Execute the following command to observe all the PHP extensions.

[root@linuxhelp1 ~]# yum search lsphp70
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.nbrc.ac.in
 * epel: epel.mirror.net.in
 * extras: mirror.nbrc.ac.in
 * updates: mirror.nbrc.ac.in
===================================================== N/S matched: lsphp70 =====================================================
lsphp70-debuginfo.x86_64 : Debug information for package lsphp70
lsphp70-pecl-igbinary-debuginfo.x86_64 : Debug information for package lsphp70-pecl-igbinary
lsphp70.x86_64 : PHP scripting language for creating dynamic web sites
lsphp70-bcmath.x86_64 : A module for PHP applications for using the bcmath library
.
.
.
lsphp70-soap.x86_64 : A module for PHP applications that use the SOAP protocol
lsphp70-tidy.x86_64 : Standard PHP module provides tidy library support
lsphp70-xml.x86_64 : A module for PHP applications which use XML
lsphp70-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol
lsphp70-zip.x86_64 : ZIP archive management extension for PHP

  Name and summary matches only, use " search all"  for everything.

To configure the Openlitespeed

Run the following command to set a password for admin.

[root@linuxhelp1 ~]# /usr/local/lsws/admin/misc/admpass.sh

Please specify the user name of administrator.
This is the user name required to login the administration Web interface.

User name [admin]: admin

Please specify the administrator' s password.
This is the password required to login the administration Web interface.

Password: 
Retype password: 
Administrator' s username/password is updated successfully!

Unfold the browser and navigate to https://< IP_address> :7080. Login with the user credentials.

Dashboard of Openlitespeed appears.

To configure the php 7

Click Server Configuration &rarr External App. Add new lsphp70 to click Add button on the right side.

Choose the type of app LiteSpeed SAPI App and click next.

And fill the fields as follows.

Name: lsphp70
Address:    uds://tmp/lshttpd/lsphp.sock
Max Connections: 35
Environment: PHP_LSAPI_MAX_REQUESTS=500
             PHP_LSAPI_CHILDREN=35
Initial Request Timeout (secs): 60
Retry Timeout : 0
Response Buffering: no
Auto Start: yes
Command: $SERVER_ROOT/lsphp70/bin/lsphp
Back Log: 100
Instances: 1
Memory Soft Limit (bytes): 2047M
Memory Hard Limit (bytes):2047M
Process Soft Limit: 400
Process Hard Limit: 500

Click Save to apply the changes.

Click Script Handler tab and edit the lsphp5 script handler to lsphp70 and then save.

To Configure Port 80

Hit the Listeners section to configure the listeners port. Click on the view icon.

Click edit icon.

And change the IP Address to ANY and Port to 80.

Once the configuration is completed. Restart the openLiteSpeed.

Open the browser and navigate to http://192.168.7.141/

Then test the PHP configuration by navigating to http://< IP_address> /phpinfo.php

Hit WebAdmin Settings &rarr Listeners to edit the default admin port. Click view to observe the port details.

Trigger edit and change the port for your admin configuration, then click Save icon.



Restart after completing the configuration.

Open the browser and navigate to https:/< IP_address> :8088

FAQ
Q
Is open lite speed completely free?
A
Yes, OpenLiteSpeed is Open Source and is free to download, use, distribute, and modify under GPLv3.
Q
how do I switch from apache to openlite speed?
A
To switch from apache to openlite speed You can create virtual hosts on OLS as you did with Apache. Configure PHP, copy the rewrite rules to the similar contexts in OLS, migrate all files and databases, and you’re done! You can al
Q
can I use OLS as load balancer for openlite speed ?
A
Yes, you may use OLS a Load Balancer for open lite speed.

Here is the general flow:

Set up the backend external apps (Fast CGI app, LSAPI app, servlet/JSP engine, and proxy web server)
Set up a load balancer e
Q
Can I use OLS on Cpanel or other control panels?
A
OpenLiteSpeed can be used with the CyberPanel control panel. No other control panels are supported at this time.
Q
Can I use memcached with OLS on openlite speed ?
A
Yes, you can. You can even try LiteSpeed Memcached, a drop-in replacement for Memcached.