How to install and configure OpenLiteSpeed ​​with PHP 7 on CentOS 7

Menu

  1. annotation
  2. Step 1 – Adding the OpenLitespeed Repository
  3. Step 2 – Installing OpenLiteSpeed
  4. Step 3 – Installing Epel Repository and PHP 7
  5. Step 4 – Configuring OpenLiteSpeed ​​and PHP 7
    1. PHP 7 setup
    2. Port 80 setting
  6. Step 5 – Testing
  7. Step 6 – Changing the Administrator’s Default Port (Optional)
  8. Output

OpenLiteSpeed ​​is an open source HTTP server developed by LiteSpeed ​​Technologies. OpenLiteSpee is a performance HTTP server that comes with a Gui web administration interface. It can handle over one hundred thousand concurrent connections with low resource usage (CPU and RAM). OpenLiteSpeed ​​supports many operating systems like Linux, Mac OS, FreeBSD and SunOS and can be used to run website scripts written in PHP, Ruby Perl, and Java.

PHP 7 is the latest version of PHP and offers better performance and lower memory consumption than PHP 5.6. It is the perfect choice for a PHP developer today.

In this tutorial, I will walk you through installing and configuring openLiteSpeed ​​and PHP 7 on CentOS 7.

Prerequisites

  • CentOS 7 is 64-bit.
  • Root privileges.

Step 1 – Adding the OpenLitespeed Repository

To install openLiteSpeed ​​on a CentOS server, we have to add to the repository. You can add it with this command:

rpm -ivh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el7.noarch.rpm

Step 2 – Installing OpenLiteSpeed

In this step, we will install openLiteSpeed ​​1.4. It is a stable version with many features such as PageSpeed, file uploads, support PHP 7, RCS integration and HTTP / 2 support.

So let’s install openLiteSpeed ​​1.4 with the following yum command:

yum -y install openlitespeed14.x86_64

Wait for the installation to complete.

Step 3 – Install Epel Repository and PHP 7

The EPEL repository is required to install PHP 7. It is available in the CentOS repository. Install the EPEL repository with the yum command:

yum -y install epel-release

Then install PHP 7 for openLiteSpeed. There is another PHP version using openLiteSpeed, PHP versions for openLiteSpeed ​​start with “LS”. Installing PHP 7 with many of the extensions, to get a rich set of features, enter the command:

yum -y install lsphp70 lsphp70-mysqlnd lsphp70-process lsphp70-mbstring lsphp70-mcrypt lsphp70-gd lsphp70-opcache lsphp70-bcmath lsphp70-pdo lsphp70-common lsphp70-xml

If you want to see a list of all PHP extensions, you can use the yum search command:

yum search lsphp70

Step 4 – Configuring OpenLiteSpeed ​​and PHP 7

In this step, we will be configuring openLiteSpeed ​​and PHP 7. OpenLiteSpeed ​​has a graphical admin interface for management, so we will set up an admin password for the openLiteSpeed ​​GUI and then configure PHP 7 to work with openLiteSpeed ​​and open the standard HTTP port 80.

Configuring and testing the admin GUI

To configure the admin user and password for managing the GUI, run the command below:

/usr/local/lsws/admin/misc/admpass.sh

Enter the username and password for your GUI management.

Then open your web browser and visit the IP address of the server with port 7080.

https://192.168.1.108:7080/

OpenLiteSpeed ​​Login

Enter your username and password and click the “Login” button to login and you will see the openLiteSpeed ​​panel.

OpenLiteSpeed ​​Dashboard

PHP 7 setup

By default openLiteSpeed ​​1.4 uses PHP 5, in this step we will change it to PHP 7.

Php 7 is installed on the server and we just need to add a new configuration via the browser GUI.

Click on “Server Configuration” and then on the “External App” tab. You will see “lsphp5” there with the socket address. Add a new “lsphp70” by clicking on the “Add” button on the right side.

Added PHP 7 support

For type, use “LiteSpeed ​​SAPI App” and click Next

LiteSpeed ​​App

Then add the config below:

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 on the save icon to save the configuration.

Save configuration.

Then go to the “Script Handler” tab and edit the “lsphp5” script handler 5. Change the name of the handler to “lsphp70”.

Suffixes: php
Handler Type: LiteSpeed SAPI
Handler Name: lsphp70

Click on the save icon.

PHP 7 Handler

Port 80 setting

The default HTTP port for openLiteSpeed ​​is 8080 and is used to receive client requests. In this step, we will change port 80 from the openLiteSpeed ​​management GUI.

On the left side, go to the “Listeners” section to see the listening configuration. You will see the default receiver with port 8080. Click the “view” icon to see detailed configuration information. Now click the “Change” button.

Port configuration

Port change

IP Address: ANY
Port 80

Change port 80 and save the configuration.

Save the port configuration

If everything is done, restart openLiteSpeed ​​by clicking on the restart button and click Yes to confirm.

Restarting openLiteSpeed

Step 5 – Testing

We can now test the server.

Visit the IP address of the server on port 80 to verify that our configuration is working as expected.

http://192.168.1.108/

OpenLiteSpeed ​​server on port 80

To check your PHP configuration click on phpinfo.php.

http://192.168.1.108/phpinfo.php

Done and everything is working as expected.

OpenLiteSpeed ​​in phpinfo ()

Step 6 – Changing the Administrator’s Default Port (Optional)

This step is optional, but I would recommend changing the default GUI admin port for openLiteSpeed.

To change the default port administrator configuration, click on “WebAdmin Settings” and then “Listeners”, now click on action to change the default port.

Changing the WebAdmin Port

Click on the “edit” button and enter the port for the administrator configuration, then click on the “Save” button.

Change admin port

Save admin port changes

Then download openLiteSpeed ​​from your browser and check the web admin.

http://192.168.1.108:8088/

Output

OpenLiteSpeed ​​is an open source HTTP server for Linux, Windows, Mac OS and BSD developed by LiteSpeed. OpenLiteSpeed uses a different version of PHP called “lsphp” and has support for lsphp7 or PHP 7. OpenLiteSpeed ​​is easy to customize the admin GUI so we can customize it from the browser.

kak-ustanovit-i-nastroit-openlitespeed-s-php-7-na-centos-logo

Sidebar